15 #ifndef DDL_STATIC_CODEC_CLASS_HEADER
16 #define DDL_STATIC_CODEC_CLASS_HEADER
31 class ElementAccessor;
160 template <
typename T>
173 template <
typename T>
384 template <
typename T>
398 template <
typename T>
468 #include <ddl/codec/legacy/static_codec_legacy.h>
Implementation of legacy access_element.
A common result class usable as return value throughout.
Container type, able to store any primitive data type (and arrays thereof)
Iteratable container type for the given Element type in ElementAccessType::element_type.
A CodecElement to get and set values.
Factory class for ddl codecs.
Fast Access Index Type for the coders.
A DecoderElement to get values.
The Leaf codec index is a small layout information index to access the decoders/codecs data very fast...
const LeafLayout & getLayout() const noexcept
Get the leaf layout.
Codec for static structures defined by a DataDefinition definition.
StaticCodec(const StaticCodec &)=delete
Noncopyable.
void setElementValue(const LeafCodecIndex &leaf_codec_index, const T &value)
Sets the current value of the given element from given value in type T.
Element getElement(const CodecIndex &codec_index)
Retrieves an element instance based on the codec index of that element.
void setElementVariantValue(const CodecIndex &codec_index, const a_util::variant::Variant &value)
Sets the current value of the given element from the given variant.
StaticCodec & operator=(const StaticCodec &)=delete
Noncopyable.
CodecElement< CodecElementAccess< StaticCodec > > Element
Static codec element.
void * getElementAddress(const CodecIndex &codec_index)
void resetValues(bool zero_values=false)
Sets all elements to their default values, constant values defined in the data definition or zero if ...
StaticCodec & operator=(StaticCodec &&)
Move assignment operator.
void setElementValue(const CodecIndex &codec_index, const T &value)
Sets the current value of the given element from given value in type T.
Element getElement(const std::string &full_element_name)
Retrieves an element instance based on the full name of the element.
StaticCodec()
Default constructor.
void setElementRawValue(const CodecIndex &codec_index, const void *value, size_t value_size)
Sets the current value of the given element by copying its data from the passed-in location.
void * getData() noexcept
Get the current set data.
Elements & getElements()
Retrieves the elements of the static codec to get element information.
void setElementStringValue(const CodecIndex &codec_index, const std::string &value)
Sets the current value of the given element from the given string.
StaticCodec(StaticCodec &&)
Move constructor.
ChildElements< CodecElementAccess< StaticCodec > > Elements
Iterator container to iterate all elements of the static decoder.
Decoder for static structures defined by a DataDefinition definition.
StaticDecoder(const StaticDecoder &)=delete
Noncopyable.
size_t getElementCount() const
is the leaf count
const void * _data
For internal use only.
a_util::result::Result getElement(size_t leaf_index, const ddl::StructElement *&legacy_struct_element) const
Returns the StructElement of the element with given leaf index.
std::shared_ptr< const StructAccess > _codec_access
For internal use only.
Element getElement(const CodecIndex &codec_index) const
Retrieves an element instance based on the codec index of that element.
Element getElement(const std::string &full_element_name) const
Retrieves an element instance based on the full name of the element.
std::string getElementFullName(const CodecIndex &codec_index) const
Retrieves the full name of the element within its main structure.
ddl::access_element::StructElementLegacy< const StaticDecoder > _legacy_element
For internal use only.
std::string getElementStringValue(const CodecIndex &codec_index) const
Returns the current value of the given element as a string.
const std::string & getElementBaseName(const CodecIndex &codec_index) const
Retrieves the base name of the element within its structured element.
void getElementVariantValue(const CodecIndex &codec_index, a_util::variant::Variant &value) const
Returns the current value of the given element as a variant.
StaticDecoder(StaticDecoder &&)
Move constructor.
size_t _data_size
For internal use only.
virtual a_util::result::Result isValid() const
CodecIndex resolve(size_t leaf_index) const
size_t getStaticBufferSize(DataRepresentation rep) const
Gets the static buffer size in bytes for the main structure.
~StaticDecoder()=default
DTOR.
StaticDecoder & operator=(const StaticDecoder &)=delete
Noncopyable.
const ddl::codec::ElementAccessor * _element_accessor
For internal use only.
std::string getElementName(const CodecIndex &codec_index) const
Retrieves the name of the element within its structured element.
size_t getDataSize() const noexcept
Get the current size (in bytes) of the data.
size_t getStaticBufferSize() const
Gets the static buffer size in bytes for the main structure.
const void * getData() const noexcept
Get the current set data.
a_util::variant::Variant getElementVariantValue(const CodecIndex &codec_index) const
Returns the current value of the given element as a variant.
StaticDecoder()
Default constructor.
T getElementValue(const CodecIndex &codec_index) const
Returns the current value of the given element as a T if supported.
void getElementRawValue(const CodecIndex &index, void *value, size_t value_size) const
Returns the current value of the given element as a variant.
ChildElements< DecoderElementAccess< const StaticDecoder > > Elements
Iterator container to iterate all elements of the static decoder.
DataRepresentation getRepresentation() const
Returns the current data representation the decoder decodes from.
const void * getElementAddress(const CodecIndex &index) const
StaticDecoder & operator=(StaticDecoder &&)
Move assignment operator.
size_t getElementChildCount(const CodecIndex &codec_index=CodecIndex()) const
Retrieves the amount of child elements for the given codec index.
DecoderElement< DecoderElementAccess< const StaticDecoder > > Element
Static decoder element.
const Elements & getElements() const
Retrieves the elements of the static decoder to get element information.
T getElementValue(const LeafCodecIndex &leaf_codec_index) const
Returns the current value of the given element as a T if supported.
void resolve(CodecIndex &codec_index) const
The codec index will be resolved for fast access (layout will be set)
Implementation of the CodecIndex.
Implementation of the CodecIterator.
Definition of Data Representation header for Codec API.
Common include for component a_util::memory.
definition of the ddl namespace
DataRepresentation
Enumeration for the data representation.
Information about an element accessible with a decoder or codec.
static ValueType getValue(const void *data, const size_t data_size, const LeafLayout &leaf_layout)
Returns the current value of the given element as a ValueType if supported.
static void setValue(void *data, const size_t data_size, const LeafLayout &leaf_layout, const ValueType &value)
Sets the current value if the given element as a ValueType if supported.
static ValueType getValue(const DecoderType &decoder, const CodecIndex &codec_index)
Returns the current value of the given element as a ValueType if supported.
static void setValue(CodecType &codec, const CodecIndex &codec_index, const ValueType &value)
Sets the current value of the given element as a ValueType if supported.
Implementation of the decoder and coder value accesss setter and getter.
Common include for component a_util::result.