You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We know that at the very early stage of development we decided to use boot: primitive types and our types on attributes. Ex: UBInt8() and int on an attribute of a generic struct subclass.
But using the library perhaps makes more sense to hide all the UBInt* stuff. So we should define the attribute as UBInt8():
classFoo(GenericStruct):
a=UBInt8()
But when using makes more sense to use only integers:
>>>foo=Foo()
>>>foo.a=8>>>foo.pack()
The same should be done on unpack, and this is the most important part. Because when unpacking we should put there a python primitive value.
>>>foo.unpack(binary_data)
>>>type(foo.a)
(int)
The trick part is that in some cases (when is not primitive) we should accept only this complex type. Ex:
classFoo(GenericStruct):
a=Header()
foo.a should only accept (before pack) only Header types.
We realized this when creating a new napp. The napp developer should not be aware of the lib internal types, like UBInt8()
Does that makes sense ?
The text was updated successfully, but these errors were encountered:
Original issue opened by @beraldoleal at kytos#198.
We know that at the very early stage of development we decided to use boot: primitive types and our types on attributes. Ex: UBInt8() and int on an attribute of a generic struct subclass.
But using the library perhaps makes more sense to hide all the UBInt* stuff. So we should define the attribute as UBInt8():
But when using makes more sense to use only integers:
The same should be done on unpack, and this is the most important part. Because when unpacking we should put there a python primitive value.
The trick part is that in some cases (when is not primitive) we should accept only this complex type. Ex:
foo.a
should only accept (before pack) only Header types.We realized this when creating a new napp. The napp developer should not be aware of the lib internal types, like
UBInt8()
Does that makes sense ?
The text was updated successfully, but these errors were encountered: