binary_data library
Bits and byte structures, and binary format/codec for encoding/decoding to/from binary data.
Classes
- Accum16
- Adcu
- marker for special handling closing the sealed hierarchy, simplifies caller defs
- Angle16
-
0, 65536-> [0.0, 1) - Angle16Deg
-
0, 65536-> [0.0, 360.0) - Angle16Rad
-
0, 65536-> [0.0, 2π) -
BinaryCodec<
V> - BinaryCodec<V>
-
BinaryCodecByHandlers<
V> - BinaryCodecIdentity
-
BinaryFormat<
S extends NativeType, V> - Serialization and storage on base int type V handle base value conversion
-
BinaryQuantityCodec<
V extends num> -
Quantity Codec - BitData
-
BitData
contain bits for setters - Cannot be extension type
allows
pass by pointeruse by BitsMap. BitsStuct, BoolMap, etc. - BitField
-
/////////////////////////////////////////////////////////////////////////////
BitField
Key for BitStruct and BitFieldMap
as mixin, applicable to
enum///////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////// A Bit-field is a class datamemberwith explicit size, in bits. https://en.cppreference.com/w/cpp/language/bit_field https://learn.microsoft.com/en-us/cpp/c-language/c-bit-fields?view=msvc-170 -
BitFieldMap<
K extends BitField> - BitFieldMap
- BitIndexField
- BitIndexField /// Special case: single-bit field addressed by index.
- Bitmask
- Bitmask
-
BitsInitializer<
K extends BitField> - BitsInitializer compile time const definition using map literal example = BitsInitializer({ EnumType.name1: 2, EnumType.name2: 3, });
-
BitsMap<
K, V> - BitsMap Common interface for [BitFieldMap, BoolMap. Enforce concrete keys as base. A special case of FixedMap, all values retrieve from a Bits object Map operators implemented by subclass depending on V type, int or bool.
-
BitStructBase<
T extends BitStructBase< T, K> , K extends BitField> - ///////////////////////////////////////////////////////////////////////////// BitStructBase — abstract base for user-defined bit struct subtypes. Analogue of StructBase for the bit domain.
-
BitStructFormat<
K extends BitField> - base type is sufficient for iteration
- Bool
- Represents a native bool in C.
- BoolFormat
-
BoolMap<
K extends dynamic> - BoolMap
-
ByteField<
V extends NativeType> - Typed Offset
-
ByteStructBase<
S extends ByteStructBase< S, K> , K extends ByteField<NativeType> > -
ByteStructBuffer<
T> - buffer type for partial view
-
ConstBitFieldMap<
K extends BitField> - ConstBits
-
ConstBoolMap<
K extends dynamic> - Decimal10
- 1 binary is .1f
- DecimalInv10
- 1 binary is 10.0f
- Double
- Represents a native 64 bit double in C.
-
DoubleLinkedQueue<
E> - A Queue implementation based on a double-linked list.
-
DoubleLinkedQueueEntry<
E> - An entry in a doubly linked list.
-
EnumFormat<
V extends Enum> -
EnumFormatByHandlers<
V extends Enum> -
EnumOffsetFormat<
V extends Enum> -
Field<
V> - Field — key to a value in a host struct, carrying accessor logic and type scope
- Fixed16
- User-defined fractBits, signed
-
FixedMap<
K, V> - FixedMap - interface for Map constraints FixedMap - fixed set of keys optimized for small fixed set of keys guarantees all keys are present can guarantee non null return - if V is defined as non nullable
-
FixedPoint<
S extends NativeType> -
FixedPointBase10<
S extends NativeType> -
FixedPointN<
S extends NativeType> - Float
- Represents a native 32 bit float in C.
- Fract16
-
FractFormat<
S extends NativeType> -
HashMap<
K, V> - A hash-table based implementation of Map.
-
HashSet<
E> - An unordered hash-table based Set implementation.
-
HasNextIterator<
E> - Wrapper for Iterator providing the pre-Dart 1.0 iterator interface.
-
IndexMap<
K extends dynamic, V> - IndexMap Default implementation using parallel arrays
- Int16
- Represents a native signed 16 bit integer in C.
- Int16Int
- Raw integer pass-through
- Int32
- Represents a native signed 32 bit integer in C.
- Int32Int
- Int64
- Represents a native signed 64 bit integer in C.
- Int8
- Represents a native signed 8 bit integer in C.
- Int8Int
-
IntFormat<
S extends NativeType> -
LinkedHashMap<
K, V> - An insertion-ordered Map with expected constant-time lookup.
-
LinkedHashSet<
E> - A LinkedHashSet is a hash-table based Set implementation.
-
LinkedList<
E extends LinkedListEntry< E> > - A specialized double-linked list of elements that extends LinkedListEntry.
-
LinkedListEntry<
E extends LinkedListEntry< E> > - An object that can be an element in a LinkedList.
-
ListBase<
E> - Abstract implementation of a list.
-
ListQueue<
E> - List based Queue.
-
MapBase<
K, V> - Base class for implementing a Map.
-
MapView<
K, V> -
Wrapper around a class that implements Map that only exposes
Mapmembers. -
MutableBitFieldMap<
K extends BitField> - MutableBits
- base for Map or Struct
-
MutableBoolMap<
K extends dynamic> - NativeType
- NativeType's subtypes represent a native type in C.
-
NativeTypeBase<
S extends NativeType> - NativeTypeBase Descriptor using NativeType as marker only. Handles size and signed
-
NumFormat<
S extends NativeType, V extends num> - Hierarchy axis on handling Int/Fract
- Packet
-
Packet as interface for
immutable viewofvarying view length. -
PacketBuffer<
T extends Packet> - /////////////////////////////////////////////////////////////////////////
-
PacketFormat<
T extends Packet> - Collective def of Packet format. Descriptor/'Class variables'
- PacketId
- PacketIdCaster
- ///////////////////////////////////////////////////////////////////////// PacketId Types ///////////////////////////////////////////////////////////////////////// build idOf from lists internally PacketIdFactory
-
PacketIdRequest<
T, R> -
Id as payload factory
A
Requestmatched with aResponsepaired request response id for simplicity in case of shared id by request and response can under define responseId for 1-way handlers as constructors, const for enum -
PacketPayloadId<
V> - PacketSyncId
-
Payload<
V> - ///////////////////////////////////////////////////////////////////////////// Payload<V> ///////////////////////////////////////////////////////////////////////////// extends Struct and Payload Payload need to contain a static cast function factory Child.cast(TypedData target); convert in place, on allocated buffer build/parse with a reference to the header, although both are part of a contiguous buffer payload class without direct context of header allows stronger encapsulation does not have to declare filler header fields for simplicity, the packet header includes all meta parameters, parsing a payload does not need stateMeta
- PayloadMeta
- any additional state not included in the header
- Percent16
-
Queue<
E> - A Queue is a collection that can be manipulated at both ends. One can iterate over the elements of a queue through forEach or with an Iterator.
-
SerializableField<
V> -
SerializableField<V>/
NamedFielda key to each field, an type parameter, with an generated string, use as json key; effectively describe the memory allocation requirements maps entirety of the struct -
SetBase<
E> - Base implementation of Set.
- SignFormat
-
SplayTreeMap<
K, V> - A Map of objects that can be ordered relative to each other.
-
SplayTreeSet<
E> - A Set of objects that can be ordered relative to each other.
- Struct
- The supertype of all FFI struct types.
-
StructInitializer<
T extends StructBase< T, K, V> , K extends Field<V> , V> - proxy over a map
- TypedDataBuffer
-
TypedDataBuffer -
BytesBuilderBuffereffectively, a fixed size BytesBuilder - allocated with a persistent buffer -
TypedField<
T extends NativeType> -
StructField/
NativeKey/StructKey, Typed 0,1,2,4,8 bytes - Uaccum16
- Ufixed16
- User-defined fractBits, unsigned
- Ufract16
- Uint16
- Represents a native unsigned 16 bit integer in C.
- Uint16Int
- Uint32
- Represents a native unsigned 32 bit integer in C.
- Uint32Int
- Uint64
- Represents a native unsigned 64 bit integer in C.
- Uint8
- Represents a native unsigned 8 bit integer in C.
- Uint8Int
-
UnmodifiableListView<
E> - An unmodifiable List view of another List.
-
UnmodifiableMapBase<
K, V> - Basic implementation of an unmodifiable Map.
-
UnmodifiableMapView<
K, V> - View of a Map that disallow modifying the map.
-
UnmodifiableSetView<
E> - An unmodifiable Set view of another Set.
-
Version<
K extends WordField< NativeType> > -
4 fields
optional, major, minor, fixby default, 1 or 2 bytes each parameterize T to constrain functions of T key to types the Version is defined with -
VersionConstruct<
K extends WordField< NativeType> > - protype objecct. flexible keys
- VersionStandard
- standard version with fixed keys and 1 byte fields, for common use. flexible keys and field sizes can be implemented with VersionConstruct.
-
WordBase<
T extends WordBase< T, K> , K extends WordField<NativeType> > -
WordField<
V extends NativeType> - a field within a WordStruct interface for including TypedField<T>, Enum type ensures bitmask is power of 2
Enums
Mixins
-
Immutable<
S extends Immutable< S> > - optional
-
Serializable<
S extends Serializable< S> > - Serializable - mixin in 1 step for serialization provide toMap or implements MapBase and duplicate code until combine mixin is support mixin toMap<K extends Enum, V> implmenting Map would require subclasses to mixin MapBase
-
StructBase<
S extends StructBase< S, K, V> , K extends Field<V> , V> - StructBase — abstract base user subtype
Extension Types
- BitForm
-
BitForm — zero-cost wrapper over a List<K> field schema.
Analogue of StructForm for the bit domain.
BitForm<K>(K.values).cast(ConstBits(raw as Bits)); - Bitmasks
- Bits
- Bits - Bitwise operations on int function of a single number, object methods over top level math functions
- BitStruct
- ///////////////////////////////////////////////////////////////////////////// BitStruct — zero-cost keyed view over a BitData object.
- ByteForm
- ByteStruct
- ByteStruct is a TypedData with keyed/named access to fields. TypedData + [] Map operators returning int keyed view mixin keyed access for serialization map
- EnumMap
-
EnumMap
A Map with the additional constraint that Keys are a
fixed set, via Enum. creation implements FixedMap/IndexMap constraints factory constructors build IndexMap by default Adds Serialization using Enum.name to a Map, Keys inherit from Enum - index via Enum.index -> create a parallel array map by default String name via Enum.name -> directly use for serialization - EnumMapFactory
- construct a Map<K extends Enum, V> from Map<String, V> on creation ensure all fields are valid
- NumDataScale
- StructData
- StructData — zero-cost keyed view over an existing object.
- StructForm
- StructForm Structure TypeClass Common viewer interface handle creation, creation here gurantees all keys are 'Struct' keys are present Conversion — bridge to Map (and therefore to serialization)
- Word
- Word - A register width variable. Implementation of Bits with byte granularity constructors/accessors. Effectively ByteData with a length of 8 bytes. Can be compile time constant, use as enum entry
- WordForm
- WordStruct
- Bits/Word + keys [] Map operators returning int
Extensions
-
BitFieldMapMethods
on BitFieldMap<
K> -
BitIndexKeysMethods
on Iterable<
BitIndexField> -
BitmasksMethods
on Iterable<
Bitmask> - ByteDataArrayAccess on ByteData
- ByteDataWordAccess on ByteData
-
EnumMapByName
on Map<
K, V> - Serialization of Map<Enum, V> interface Methods on loose contraints Map<Enum, V> Enum.name base methods are applicable regardless of EnumMap FixedMap constraints add fills existing Map only
-
EnumNamedValues
on Iterable<
MapEntry< K, V> > - IntToBits on int
-
IterableExtensions
on Iterable<
T> - Operations on iterables.
-
NullableIterableExtensions
on Iterable<
T?> - Operations on iterables with nullable elements.
- PacketIdMethods on PacketId
-
SerializableKeys
on StructForm<
K, V> -
SerializableKeysType
on StructForm<
K, Object> -
SerializableMethods
on Serializable<
Serializable> - SizedWord on ByteData
- TypedDataCast on TypedData
-
/////////////////////////////////////////////////////////////////////////////
sublistView using length instead of
endEffectively moving up ByteBuffer layer, to TypedData view segment accounting forthis.offsetInBytes///////////////////////////////////////////////////////////////////////////// offsets in bytes for simplicity, correspond with ByteBuffer length using type size - TypedDataLength on TypedData
-
/////////////////////////////////////////////////////////////////////////////
implementations on TypedData returning as
thistype parameters in element size ofthistype ///////////////////////////////////////////////////////////////////////////// - TypedDataListSeek on T
- TypedList version of List<int>.skip
- TypedDataSlices on T
- Slices returning TypedData Slices on List cannot return TypedData
- TypedDataToInt on TypedData
- /////////////////////////////////////////////////////////////////////////////
-
TypedStructReference
on ({StructData<
K, V> data, StructForm<K, V> type})
Functions
-
bytesPerElementOf<
T extends TypedData> () → int -
fromListInt<
T extends TypedDataList< (int> >List< int> elements) → T -
sublistView<
T extends TypedData> (TypedData data, [int start = 0, int? end]) → T -
GenericSublistView
offset in elements, type of
data, notTtype. -
typedList<
T extends TypedDataList> (int length) → T -
/////////////////////////////////////////////////////////////////////////////
Wrappers as top level functions
/////////////////////////////////////////////////////////////////////////////
length is in elements
same as
ByteData(length * bytesPerElementOf<T>())
Typedefs
-
BitFieldEntry<
K extends BitField> = StructField< K, int> -
DataDecoder<
T> = T Function(int data) -
DataEncoder<
T> = int Function(T view) - DataOfNum = int Function(num view)
-
FieldMap<
K extends Field< V> , V> = Map<K, V> -
IterableBase<
E> = Iterable< E> - Base class for implementing Iterable.
-
IterableMixin<
E> = Iterable< E> -
This Iterable mixin implements all Iterable members except
iterator. -
ListMixin<
E> = ListBase< E> - Base mixin implementation of a List class.
-
MapMixin<
K, V> = MapBase< K, V> - Mixin implementing a Map.
- NumDataConversion = ({DataOfNum dataOfView, NumOfData viewOfData})
- NumOfData = num Function(int data)
- Numeric value conversion
-
PacketCaster<
P extends Packet> = P Function(TypedData typedData) -
PayloadCaster<
V> = Payload< V> Function(TypedData typedData) -
Payload Constructor - handler per id
Struct.create<T> -
SerializableEntry<
V> = ({SerializableField< V> key, V value}) -
SetMixin<
E> = SetBase< E> - Mixin implementation of Set.
-
StructField<
K extends Field< V> , V> = ({K key, V value}) -
TypedDataCaster<
T> = T Function(TypedData typedData) -
T is ByteStruct or
ffi.Struct