ADTF
|
Factory class for ddl codecs. More...
Public Types | |
typedef FactoryElement< FactoryElementAccess< const CodecFactory > > | Element |
Type of a single factory element. | |
typedef ChildElements< FactoryElementAccess< const CodecFactory > > | Elements |
Iterator container to iterate all elements of the factory. More... | |
Public Member Functions | |
CodecFactory () | |
Empty constructor. More... | |
CodecFactory (const CodecFactory &) | |
copy CTOR | |
CodecFactory & | operator= (const CodecFactory &) |
copy assignment operator More... | |
CodecFactory (CodecFactory &&) | |
move CTOR | |
CodecFactory & | operator= (CodecFactory &&) |
move assignment operator More... | |
~CodecFactory ()=default | |
Default dtor. | |
CodecFactory (const std::string &struct_name, const std::string &dd_string) | |
Constructor that take a DataDefinition string for initialization. More... | |
CodecFactory (const ddl::dd::StructType &struct_type, const dd::DataDefinition &dd) | |
Constructor that uses an OO-DataDefinition struct for initialization. More... | |
CodecFactory (const DDStructure &dd_struct) | |
Constructor that uses an OO-DataDefinition struct for initialization. More... | |
CodecFactory (const ddl::dd::StructTypeAccess &struct_type_access) | |
Constructor that uses an StructTypeAccess for initialization. More... | |
a_util::result::Result | isValid () const |
Check if the factory is in a valid state. More... | |
StaticDecoder | makeStaticDecoderFor (const void *data, size_t data_size, DataRepresentation rep=deserialized) const |
Creates a static decoder for the given data. More... | |
StaticCodec | makeStaticCodecFor (void *data, size_t data_size, DataRepresentation rep=deserialized) const |
Creates a static codec for the given data. More... | |
Decoder | makeDecoderFor (const void *data, size_t data_size, DataRepresentation rep=deserialized) const |
Creates a decoder for the given data. More... | |
Codec | makeCodecFor (void *data, size_t data_size, DataRepresentation rep=deserialized) const |
Creates a codec for the given data. More... | |
Element | getElement (const CodecIndex &codec_index) const |
Retrieves an element instance based on the codec index of that element. More... | |
Element | getElement (const std::string &full_element_name) const |
Retrieves an element instance based on the full name of the element. More... | |
const Elements & | getElements () const |
Retrieves the elements of the factory to get element information. More... | |
size_t | getElementChildCount (const CodecIndex &codec_index=CodecIndex()) const |
Retrieves the amount of child elements for the given codec index. More... | |
std::string | getElementFullName (const CodecIndex &codec_index) const |
Retrieves the full name of the element within its main structure. More... | |
std::string | getElementName (const CodecIndex &codec_index) const |
Retrieves the name of the element within its structured element. More... | |
const std::string & | getElementBaseName (const CodecIndex &codec_index) const |
Retrieves the base name of the element within its structured element. More... | |
size_t | getStaticBufferSize (DataRepresentation rep=deserialized) const |
Gets the static buffer size in bytes for the structure. More... | |
void | resolve (CodecIndex &codec_index) const |
The codec index will be resolved for fast access. More... | |
CodecIndex | resolve (size_t leaf_index) const |
Legacy: Resolves given the leaf index to a codec index. More... | |
CodecIndex | 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. More... | |
size_t | getStaticElementCount () const |
Legacy: Returns the amount of static (leaf) elements. More... | |
a_util::result::Result | getStaticElement (size_t leaf_index, const ddl::StructElement *&legacy_struct_element) const |
Legacy: Returns the StructElement of the element with given leaf index. More... | |
Private Attributes | |
std::shared_ptr< const StructAccess > | _codec_access |
For internal use only. | |
a_util::result::Result | _constructor_result |
For internal use only. | |
Element | _first_element |
For internal use only. | |
ddl::access_element::StructElementLegacy< const CodecFactory > | _legacy_element |
For internal use only. | |
Factory class for ddl codecs.
Definition at line 31 of file workspace/conan/dev_essential/1.4.3/dw/stable/package/aef85909f792a5a628750d25016a24323084963f/include/ddl/codec/codec_factory.h.
typedef ChildElements<FactoryElementAccess<const CodecFactory> > Elements |
Iterator container to iterate all elements of the factory.
Definition at line 174 of file workspace/conan/dev_essential/1.4.3/dw/stable/package/aef85909f792a5a628750d25016a24323084963f/include/ddl/codec/codec_factory.h.
CodecFactory | ( | ) |
Empty constructor.
This exists to enable uninitialized member variables of this type that are move-assigned later on.
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. |
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 |
CodecFactory | ( | const DDStructure & | dd_struct | ) |
Constructor that uses an OO-DataDefinition struct for initialization.
[in] | dd_struct | The struct definition. |
CodecFactory | ( | const ddl::dd::StructTypeAccess & | struct_type_access | ) |
Constructor that uses an StructTypeAccess for initialization.
[in] | struct_type_access | The struct type access. |
Element 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 getElement | ( | const std::string & | full_element_name | ) | const |
Retrieves an element instance based on the full name of the element.
[in] | full_element_name | 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& 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 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 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 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& getElements | ( | ) | const |
Retrieves the elements of the factory to get element information.
size_t 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 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 getStaticElementCount | ( | ) | const |
Legacy: Returns the amount of static (leaf) elements.
a_util::result::Result isValid | ( | ) | const |
Check if the factory is in a valid state.
Codec 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 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. |
Definition at line 114 of file workspace/conan/dev_essential/1.4.3/dw/stable/package/aef85909f792a5a628750d25016a24323084963f/include/ddl/codec/codec_factory.h.
References CodecFactory::_codec_access.
|
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. |
Definition at line 100 of file workspace/conan/dev_essential/1.4.3/dw/stable/package/aef85909f792a5a628750d25016a24323084963f/include/ddl/codec/codec_factory.h.
References CodecFactory::_codec_access.
CodecFactory& operator= | ( | CodecFactory && | ) |
move assignment operator
CodecFactory& operator= | ( | const CodecFactory & | ) |
copy assignment operator
void 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 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 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. |