ADTF  3.18.2
builds/digitalwerk/solutions/adtf_content/adtf_base/adtf_core/extern/pkg_ddl/include/adtfddl/codec/codec_factory.h
Go to the documentation of this file.
1 
7 #ifndef _DDL_CODEC_FACTORY_CLASS_HEADER_
8 #define _DDL_CODEC_FACTORY_CLASS_HEADER_
9 
10 #include "static_codec.h"
11 #include "codec.h"
12 
14 
15 namespace adtf_ddl
16 {
21 {
22 public:
27  PKG_ADTF_DDL_DEPRECATED("Use ddl::CodecFactory instead.")
29 
35  PKG_ADTF_DDL_DEPRECATED("Use ddl::CodecFactory instead.")
36  cCodecFactory(const char* strStructName,
37  const char* strMediaDescription);
38 
43  PKG_ADTF_DDL_DEPRECATED("Use ddl::CodecFactory instead.")
44  cCodecFactory(const cDDLComplex* pStruct);
45 
50 
51 #ifndef WIN32
52  // the missing const above was an oversight and lead to problems with older GCCs when storing
53  // cCodecFactory in STL containers and pairs.
57  cCodecFactory(const cCodecFactory&) = default;
58 #endif
59 
72 
77  tResult IsValid() const;
78 
86  inline cStaticDecoder MakeStaticDecoderFor(const void* pData, size_t nDataSize, tDataRepresentation eRep = tDataRepresentation::Deserialized) const
87  {
88  return cStaticDecoder(m_pLayout, pData, nDataSize, eRep);
89  }
90 
98  inline cStaticCodec MakeStaticCodecFor(void* pData, size_t nDataSize, tDataRepresentation eRep = tDataRepresentation::Deserialized) const
99  {
100  return cStaticCodec(m_pLayout, pData, nDataSize, eRep);
101  }
102 
110  inline cDecoder MakeDecoderFor(const void* pData, size_t nDataSize, tDataRepresentation eRep = tDataRepresentation::Deserialized) const
111  {
112  return cDecoder(m_pLayout, pData, nDataSize, eRep);
113  }
114 
122  inline cCodec MakeCodecFor(void* pData, size_t nDataSize, tDataRepresentation eRep = tDataRepresentation::Deserialized) const
123  {
124  return cCodec(m_pLayout, pData, nDataSize, eRep);
125  }
126 
130  size_t GetStaticElementCount() const;
131 
138  tResult GetStaticElement(size_t nIndex, const tStructElement*& pElement) const;
139 
145  static const char* GetStaticStructElementName(const tStructElement* pElement);
146 
152 
153 private:
155  std::shared_ptr<const cStructLayout> m_pLayout;
158 };
159 
160 } // namespace adtf_ddl
161 
162 #endif
static const char * GetStaticStructElementName(const tStructElement *pElement)
Access information about an element.
cCodecFactory & operator=(cCodecFactory &&)=default
Move assignment operator.
size_t GetStaticBufferSize(tDataRepresentation eRep=tDataRepresentation::Deserialized) const
cStaticDecoder MakeStaticDecoderFor(const void *pData, size_t nDataSize, tDataRepresentation eRep=tDataRepresentation::Deserialized) const
Creates a static decoder for the given data.
cCodecFactory(const cCodecFactory &)=default
Copy constructor.
tResult IsValid() const
Check if the factory is in a valid state.
cCodec MakeCodecFor(void *pData, size_t nDataSize, tDataRepresentation eRep=tDataRepresentation::Deserialized) const
Creates a codec for the given data.
tResult GetStaticElement(size_t nIndex, const tStructElement *&pElement) const
Access information about an element.
cStaticCodec MakeStaticCodecFor(void *pData, size_t nDataSize, tDataRepresentation eRep=tDataRepresentation::Deserialized) const
Creates a static codec for the given data.
size_t GetStaticElementCount() const
cCodecFactory & operator=(cCodecFactory &)=default
Assignment operator.
cCodecFactory(cCodecFactory &&)=default
Move constructor.
cDecoder MakeDecoderFor(const void *pData, size_t nDataSize, tDataRepresentation eRep=tDataRepresentation::Deserialized) const
Creates a decoder for the given data.
Representation for a complex datatype inside a DDL specification.
Definition: ddlcomplex.h:35
Namespace for the mainpage_pkg_ddl.
Copyright © Audi Electronics Venture GmbH.
#define PKG_ADTF_DDL_DEPRECATED(_depr_message_)
Mark a function or variable as deprecated.
Implementation of the StaticCodec and StaticDecoder.
Implementation of the Codec and Decoder.