|
Dev Essential
1.6.3
|
#include <codec_factory.h>
Public Types | |
| typedef FactoryElement< FactoryElementAccess< const CodecFactory > > | Element |
| typedef ChildElements< FactoryElementAccess< const CodecFactory > > | Elements |
Public Member Functions | |
| CodecFactory () | |
| CodecFactory (const CodecFactory &) | |
| copy CTOR | |
| CodecFactory & | operator= (const CodecFactory &) |
| copy assignment operator | |
| CodecFactory (CodecFactory &&) | |
| move CTOR | |
| CodecFactory & | operator= (CodecFactory &&) |
| move assignment operator | |
| ~CodecFactory ()=default | |
| Default dtor. | |
| CodecFactory (const std::string &struct_name, const std::string &dd_string) | |
| CodecFactory (const ddl::dd::StructType &struct_type, const dd::DataDefinition &dd) | |
| CodecFactory (const DDStructure &dd_struct) | |
| CodecFactory (const ddl::dd::StructTypeAccess &struct_type_access) | |
| a_util::result::Result | isValid () const |
| StaticDecoder | makeStaticDecoderFor (const void *data, size_t data_size, DataRepresentation rep=deserialized) const |
| StaticCodec | makeStaticCodecFor (void *data, size_t data_size, DataRepresentation rep=deserialized) const |
| Decoder | makeDecoderFor (const void *data, size_t data_size, DataRepresentation rep=deserialized) const |
| Codec | makeCodecFor (void *data, size_t data_size, DataRepresentation rep=deserialized) const |
| Element | getElement (const CodecIndex &codec_index) const |
| Element | getElement (std::string_view full_path) const |
| Element | getChildElement (const CodecIndex &parent_codec_index, std::string_view relative_path) const |
| const Elements & | getElements () const |
| size_t | getElementChildCount (const CodecIndex &codec_index=CodecIndex()) const |
| std::string | getElementFullName (const CodecIndex &codec_index) const |
| Retrieves the full name of the element within its main structure. | |
| std::string | getElementName (const CodecIndex &codec_index) const |
| Retrieves the name of the element within its structured element. | |
| const std::string & | getElementBaseName (const CodecIndex &codec_index) const |
| Retrieves the base name of the element within its structured element. | |
| size_t | getStaticBufferSize (DataRepresentation rep=deserialized) const |
| Gets the static buffer size in bytes for the structure. | |
| void | resolve (CodecIndex &codec_index) const |
| CodecIndex | resolve (size_t leaf_index) const |
| CodecIndex | resolve (size_t leaf_index, std::string &full_element_name) const |
| size_t | getStaticElementCount () const |
| a_util::result::Result | getStaticElement (size_t leaf_index, const ddl::StructElement *&legacy_struct_element) const |
Factory class for ddl codecs.
| typedef FactoryElement<FactoryElementAccess<const CodecFactory> > ddl::codec::CodecFactory::Element |
Type of a single factory element.
| typedef ChildElements<FactoryElementAccess<const CodecFactory> > ddl::codec::CodecFactory::Elements |
Iterator container to iterate all elements of the factory.
| ddl::codec::CodecFactory::CodecFactory | ( | ) |
Empty constructor. This exists to enable uninitialized member variables of this type that are move-assigned later on.
| ddl::codec::CodecFactory::CodecFactory | ( | const std::string & | struct_name, |
| const std::string & | dd_string ) |
Constructor that take a DataDefinition string for initialization.
| [in] | struct_name | The name of the struct for which codecs should be generated. |
| [in] | dd_string | The DataDefinition description within a (xml)string. |
| ddl::codec::CodecFactory::CodecFactory | ( | const ddl::dd::StructType & | struct_type, |
| const dd::DataDefinition & | dd ) |
Constructor that uses an OO-DataDefinition struct for initialization.
| [in] | struct_type | The struct definition. |
| [in] | dd | The DD |
| ddl::codec::CodecFactory::CodecFactory | ( | const DDStructure & | dd_struct | ) |
Constructor that uses an OO-DataDefinition struct for initialization.
| [in] | dd_struct | The struct definition. |
| ddl::codec::CodecFactory::CodecFactory | ( | const ddl::dd::StructTypeAccess & | struct_type_access | ) |
Constructor that uses an StructTypeAccess for initialization.
| [in] | struct_type_access | The struct type access. |
| Element ddl::codec::CodecFactory::getChildElement | ( | const CodecIndex & | parent_codec_index, |
| std::string_view | relative_path ) const |
Retrieves an element instance based on the child name of the element.
| [in] | parent_codec_index | The parent codec index. |
| [in] | relative_path | The child name of the element in point notation (i.e. "child_element[4].element_value"). |
By using an empty string the deserialized decoding information within CodecIndex will retrieve the same codec index as it is before.
| throws | std::runtime_error if not found. |
| Element ddl::codec::CodecFactory::getElement | ( | const CodecIndex & | codec_index | ) | const |
Retrieves an element instance based on the codec index of that element.
| [in] | codec_index | The codec index. |
| throws | std::runtime_error if not found. |
| Element ddl::codec::CodecFactory::getElement | ( | std::string_view | full_path | ) | const |
Retrieves an element instance based on the full name of the element.
| [in] | full_path | The full name of the element in point notation (i.e. "element1.child_element[4].element_value"). |
By using an empty string the deserialized decoding information within CodecIndex will retrieve the buffers first address and whole buffersize. By refering an array without dedicated array index position the deserialized decoding information within CodecIndex will be set to the arrays first address and the whole array size. By refering an structured value (not a leaf value) the deserialized decoding information within CodecIndex will be set to the structs first address and the whole struct size.
| throws | std::runtime_error if not found. |
| const std::string & ddl::codec::CodecFactory::getElementBaseName | ( | const CodecIndex & | codec_index | ) | const |
Retrieves the base name of the element within its structured element.
If the element is an array you get the elements base name representation : "element_name" for each array element. If the element is not an array you get the elements name representation is also the base name representation: "element_name".
| [in] | codec_index | The codec index of the element. |
| throws | std::runtime_error if not found. |
| size_t ddl::codec::CodecFactory::getElementChildCount | ( | const CodecIndex & | codec_index = CodecIndex() | ) | const |
Retrieves the amount of child elements for the given codec index.
| [in] | codec_index | The codec index of the element. |
| 0 | has no children. May be a leaf element. |
| >0 | has children. May be a structured element. |
| throws | std::runtime_error if not found. |
| std::string ddl::codec::CodecFactory::getElementFullName | ( | const CodecIndex & | codec_index | ) | const |
Retrieves the full name of the element within its main structure.
If the element is an array you get the elements array name representation: "main_element.element_name[0]" or main_element.element_name[1] ... etc. If the element is not an array you get the elements name representation: "main_element.element_name".
| [in] | codec_index | The codec index of the element. |
| throws | std::runtime_error if not found. |
| std::string ddl::codec::CodecFactory::getElementName | ( | const CodecIndex & | codec_index | ) | const |
Retrieves the name of the element within its structured element.
If the element is an array you get the elements array name representation: "element_name[0]" or element_name[1] ... etc. If the element is not an array you get the elements name representation: "element_name".
| [in] | codec_index | The codec index of the element. |
| throws | std::runtime_error if not found. |
| const Elements & ddl::codec::CodecFactory::getElements | ( | ) | const |
Retrieves the elements of the factory to get element information.
| size_t ddl::codec::CodecFactory::getStaticBufferSize | ( | DataRepresentation | rep = deserialized | ) | const |
Gets the static buffer size in bytes for the structure.
| rep | option to retrieve size in bytes for the deserialized or serialized representation. |
| size_t | size in bytes of the structure depending on the given representation rep |
| a_util::result::Result ddl::codec::CodecFactory::getStaticElement | ( | size_t | leaf_index, |
| const ddl::StructElement *& | legacy_struct_element ) const |
Legacy: Returns the StructElement of the element with given leaf index.
| [in] | leaf_index | The leaf index of the element. |
| [out] | legacy_struct_element | the struct element legacy description. |
| size_t ddl::codec::CodecFactory::getStaticElementCount | ( | ) | const |
Legacy: Returns the amount of static (leaf) elements.
| a_util::result::Result ddl::codec::CodecFactory::isValid | ( | ) | const |
Check if the factory is in a valid state.
| Codec ddl::codec::CodecFactory::makeCodecFor | ( | void * | data, |
| size_t | data_size, | ||
| DataRepresentation | rep = deserialized ) const |
Creates a codec for the given data.
| [in] | data | The pointer to the raw data. |
| [in] | data_size | The size of the raw data. |
| [in] | rep | The representation that the data is encoded in. |
| Decoder ddl::codec::CodecFactory::makeDecoderFor | ( | const void * | data, |
| size_t | data_size, | ||
| DataRepresentation | rep = deserialized ) const |
Creates a decoder for the given data.
| [in] | data | The pointer to the raw data. |
| [in] | data_size | The size of the raw data. |
| [in] | rep | The representation that the data is encoded in. |
|
inline |
Creates a static codec for the given data.
| [in] | data | The pointer to the raw data. |
| [in] | data_size | The size of the raw data. |
| [in] | rep | The representation that the data is encoded in. |
|
inline |
Creates a static decoder for the given data.
| [in] | data | The pointer to the raw data. |
| [in] | data_size | The size of the raw data. |
| [in] | rep | The representation that the data is encoded in. |
| CodecFactory & ddl::codec::CodecFactory::operator= | ( | CodecFactory && | ) |
move assignment operator
| CodecFactory & ddl::codec::CodecFactory::operator= | ( | const CodecFactory & | ) |
copy assignment operator
| void ddl::codec::CodecFactory::resolve | ( | CodecIndex & | codec_index | ) | const |
The codec index will be resolved for fast access.
| [in] | codec_index | The codec index to resolve. |
| throws | std::runtime_error if not found. |
| CodecIndex ddl::codec::CodecFactory::resolve | ( | size_t | leaf_index | ) | const |
Legacy: Resolves given the leaf index to a codec index.
| [in] | leaf_index | The leaf index of the element. |
| std::runtime_error | if index not found. |
| CodecIndex ddl::codec::CodecFactory::resolve | ( | size_t | leaf_index, |
| std::string & | full_element_name ) const |
Legacy: Resolves the given leaf index to a codec index and the full element name.
| [in] | leaf_index | The leaf index of the element. |
| [in,out] | full_element_name | element name to retrieve. |
| std::runtime_error | if index not found. |