reven2.types._type.Type(object) class documentationreven2.types._type
          
          (View In Hierarchy)
        
      Known subclasses: reven2.types._array.Array, reven2.types._integer.Integer, reven2.types._pointer.Pointer, reven2.types._primitive.Primitive, reven2.types._primitive.PrimitiveBool, reven2.types._string.CString
An abstract class whose instances represent a type. Refer to the module documentation for details.
Implementers must provide the _construct_type method.
| Method | parse | Parses the value of an instance of this type from a raw buffer, possibly depending on the context. | 
| Method | size_bytes | The minimal number of bytes necessary to hold an instance of this type, possibly depending on the context. | 
| Method | is_context_sensitive | Whether the context argument needed by some methods actually has an effect. | 
| Method | _construct_type | Return the underlying constructinstance | 
Return the underlying construct instance
Parses the value of an instance of this type from a raw buffer, possibly depending on the context.
| Parameters | context | The context object. See package documentation. | 
The minimal number of bytes necessary to hold an instance of this type, possibly depending on the context.
| Returns | An integer. | |
Whether the context argument needed by some methods actually has an effect.
Types that return False to this method are context-insensitive types. You can safely pass any object as context parameter (including None) to the methods of such type.
Note that the context-sensitivity of a type may change in the future.
Getting the size of a type without needing a context for context-insensitive types: >>> types.U32.is_context_sensitive() False >>> types.U32.size_bytes(context=None) 4 >>> array32_12 = types.Array(types.U32, 12) >>> array32_12.is_context_sensitive() False >>> array32_12.size_bytes() # context=None by default 48
Context-sensitive types may raise errors when attempting to get the size without a context: >>> types.USize.is_context_sensitive() True >>> types.USize.size_bytes(context=None) ValueError: Please provide a context when using a context-sensitive type