ADTF  3.14.3
conan_home_relwithdebinfo/.conan/data/dev_essential/1.1.4/fep/stable/package/5bba22a1f4e8057d230d54fdd86f43a9aa5ca5fe/include/ddl/codec/codec_factory.h
Go to the documentation of this file.
1 
21 #ifndef DDL_CODEC_FACTORY_CLASS_HEADER
22 #define DDL_CODEC_FACTORY_CLASS_HEADER
23 
24 #include <ddl/codec/codec.h>
25 #include <ddl/codec/static_codec.h>
26 #include <ddl/codec/struct_element.h>
27 #include <ddl/dd/dd.h>
28 #include <ddl/dd/ddstructure.h>
29 
30 namespace ddl {
34 class CodecFactory {
35 public:
41 
47  CodecFactory(const std::string& struct_name, const std::string& dd_string);
48 
55 
60  CodecFactory(const ddl::dd::StructTypeAccess& struct_type_access);
61 
66  CodecFactory(const DDStructure& dd_struct);
67 
73 
81  inline StaticDecoder makeStaticDecoderFor(const void* data,
82  size_t data_size,
83  DataRepresentation rep = deserialized) const
84  {
85  return StaticDecoder(_layout, data, data_size, rep);
86  }
87 
95  inline StaticCodec makeStaticCodecFor(void* data,
96  size_t data_size,
97  DataRepresentation rep = deserialized) const
98  {
99  return StaticCodec(_layout, data, data_size, rep);
100  }
101 
109  inline Decoder makeDecoderFor(const void* data,
110  size_t data_size,
111  DataRepresentation rep = deserialized) const
112  {
113  return Decoder(_layout, data, data_size, rep);
114  }
115 
123  inline Codec makeCodecFor(void* data,
124  size_t data_size,
125  DataRepresentation rep = deserialized) const
126  {
127  return Codec(_layout, data, data_size, rep);
128  }
129 
133  size_t getStaticElementCount() const;
134 
141  a_util::result::Result getStaticElement(size_t index, const StructElement*& element) const;
142 
148 
149 private:
151  a_util::memory::shared_ptr<const StructLayout> _layout;
154 };
155 
156 } // namespace ddl
157 
158 #endif
A common result class usable as return value throughout.
Codec makeCodecFor(void *data, size_t data_size, DataRepresentation rep=deserialized) const
Creates a codec for the given data.
a_util::result::Result isValid() const
Check if the factory is in a valid state.
CodecFactory(const std::string &struct_name, const std::string &dd_string)
Constructor that take a DataDefinition string for initialization.
CodecFactory(const DDStructure &dd_struct)
Constructor that uses an OO-DataDefinition struct for initialization.
StaticCodec makeStaticCodecFor(void *data, size_t data_size, DataRepresentation rep=deserialized) const
Creates a static codec for the given data.
StaticDecoder makeStaticDecoderFor(const void *data, size_t data_size, DataRepresentation rep=deserialized) const
Creates a static decoder for the given data.
CodecFactory(const ddl::dd::StructTypeAccess &struct_type_access)
Constructor that uses an valid struct type access for initialization.
Decoder makeDecoderFor(const void *data, size_t data_size, DataRepresentation rep=deserialized) const
Creates a decoder for the given data.
CodecFactory(const ddl::dd::StructType &struct_type, const dd::DataDefinition &dd)
Constructor that uses an OO-DataDefinition struct for initialization.
CodecFactory()
Empty constructor.
a_util::result::Result getStaticElement(size_t index, const StructElement *&element) const
Access information about an element.
size_t getStaticElementCount() const
size_t getStaticBufferSize(DataRepresentation rep=deserialized) const
Utility class for a complete valid data definition of one StructType and its dependencies.
Definition: ddstructure.h:61
The Data Definiton class uses the validation model to keep a Data Definition datamodel (ddl::dd::data...
Definition: dd.h:93
Accessing class for a instance of a struct.
observable DataDefinition object class to describe StructType.
OO DataDefinition - Data Definition.
@ struct_type
value for struct type
Definition: ddl_capi.h:63
OO DataDefinition DDStructure Header.
definition of the ddl namespace
DataRepresentation
Enumeration for the data representation.
@ deserialized
deserialized data, c-structs, arrays, ...

Copyright © Audi Electronics Venture GmbH. All rights reserved. (Generated on Thu Jun 9 2022 by doxygen 1.9.1)