ADTF  3.18.2
ddldescription.h
Go to the documentation of this file.
1 
7 #ifndef _DDL_DESCRIPTION_H_INCLUDED_
8 #define _DDL_DESCRIPTION_H_INCLUDED_
9 
11 
12 namespace adtf_ddl
13 {
17  class cDDLDescription : public cDDL
18  {
19  public:
32  PKG_ADTF_DDL_DEPRECATED("Use ddl::dd::DataDefinition instead.")
34  const tDDLUnitVec& vecDDLUnits = tDDLUnitVec(),
35  const tDDLBaseunitVec& vecDDLBaseunits = tDDLBaseunitVec(),
36  const tDDLPrefixVec& vecDDLPrefixes = tDDLPrefixVec(),
37  const tDDLDTVec& vecDTs = tDDLDTVec(),
38  const tDDLComplexVec& vecStructs = tDDLComplexVec(),
39  const tDDLStreamVec& vecStreams = tDDLStreamVec(),
40  const tDDLEnumVec& vecEnums = tDDLEnumVec(),
41  bool bMergeDefaults = true);
42 
46  virtual ~cDDLDescription();
47 
48  tResult Accept(IDDLVisitor *poVisitor);
49 
50  bool IsInitialized() const;
51 
52  const A_UTILS_NS::cString& GetName() const;
53 
67  tDDLUnitVec vecDDLUnits = tDDLUnitVec(),
68  tDDLBaseunitVec vecDDLBaseunits = tDDLBaseunitVec(),
69  tDDLPrefixVec vecDDLPrefixes = tDDLPrefixVec(),
70  tDDLDTVec vecDTs = tDDLDTVec(),
71  tDDLComplexVec vecStructs = tDDLComplexVec(),
72  tDDLStreamVec vecStreams = tDDLStreamVec(),
73  tDDLEnumVec vecEnums = tDDLEnumVec());
74 
79  cDDLHeader * GetHeader() const;
80 
87  void CloneUnits(const tDDLUnitVec& vecDDLUnits);
88 
95  void RefUnits(tDDLUnitVec& vecDDLUnits);
96 
105  void MergeUnits(tDDLUnitVec vecDDLUnits, uint32_t ui32JoinFlags = 0, tDDLVec* pvecDeleteData = NULL);
106 
114  void AddUnit(cDDLUnit* poUnit, int nPos = -1);
115 
121 
126  const tDDLUnitVec& GetUnits() const;
127 
128 
134  const cDDLUnit* GetUnitByName(const A_UTILS_NS::cString& strName) const;
135 
142 
149  void CloneBaseunits(const tDDLBaseunitVec& vecDDLBaseunits);
150 
157  void RefBaseunits(tDDLBaseunitVec& vecDDLBaseunits);
158 
167  void MergeBaseunits(tDDLBaseunitVec vecDDLBaseunits, uint32_t ui32JoinFlags = 0, tDDLVec* pvecDeleteData = NULL);
168 
176  void AddBaseunit(cDDLBaseunit* poBaseunit, int nPos = -1);
177 
183 
189  const cDDLBaseunit* GetBaseunitByName(const A_UTILS_NS::cString& strName) const;
190 
197 
204  void ClonePrefixes(const tDDLPrefixVec& vecDDLPrefixes);
205 
212  void RefPrefixes(tDDLPrefixVec& vecDDLPrefixes);
213 
222  void MergePrefixes(tDDLPrefixVec vecDDLPrefixes, uint32_t ui32JoinFlags = 0, tDDLVec* pvecDeleteData = NULL);
223 
231  void AddPrefix(cDDLPrefix* poPrefix, int nPos = -1);
232 
238 
245 
251  const cDDLPrefix* GetPrefixByName(const A_UTILS_NS::cString& strName) const;
252 
259  void CloneDatatypes(const tDDLDTVec& vecDDLDataTypes);
260 
267  void RefDatatypes(tDDLDTVec& vecDDLDataTypes);
268 
269 
276  void RefEnums(tDDLEnumVec& vecDDLEnum);
277 
286  void MergeEnums(tDDLEnumVec vecDDLEnum, uint32_t ui32JoinFlags = 0, tDDLVec* pvecDeleteData = NULL);
287 
294  void CloneEnums(const tDDLEnumVec& vecDDLEnums);
295 
303  void AddEnum(cDDLEnum* poEnum, int nPos = -1);
304 
311 
317  const cDDLEnum* GetEnumByName(const A_UTILS_NS::cString& strName) const;
318 
327  void MergeDatatypes(tDDLDTVec vecDDLDataTypes, uint32_t ui32JoinFlags = 0, tDDLVec* pvecDeleteData = NULL);
328 
336  void AddDatatype(cDDLDataType* poDatatype, int nPos = -1);
337 
343 
348  const tDDLDTVec& GetDatatypes() const;
349 
355 
360  const tDDLEnumVec& GetEnums() const;
361 
368 
374  const cDDLDataType* GetDataTypeByName(const A_UTILS_NS::cString& strName) const;
375 
382  void CloneStructs(const tDDLComplexVec& vecStructs);
383 
390  void RefStructs(tDDLComplexVec& vecStructs);
391 
400  void MergeStructs(tDDLComplexVec vecStructs, uint32_t ui32JoinFlags = 0, tDDLVec* pvecDeleteData = NULL);
401 
409  void AddStruct(cDDLComplex *poStruct, int nPos = -1);
410 
416 
421  const tDDLComplexVec& GetStructs() const;
422 
428  const cDDLComplex * GetStructByName(const A_UTILS_NS::cString& strName) const;
429 
436 
446 
456 
466 
473  tResult MoveHeaderExcDec(const int nFrom, const int nTo);
474 
481  tResult MoveBaseunit(const int nFrom, const int nTo);
482 
489  tResult MovePrefix(const int nFrom, const int nTo);
490 
497  tResult MoveUnit(const int nFrom, const int nTo);
498 
506  tResult MoveRefUnit(const int nFrom,
507  const int nTo,
508  const A_UTILS_NS::cString& strParent);
509 
516  tResult MoveEnum(const int nFrom, const int nTo);
517 
525  tResult MoveEnumElement(const int nFrom,
526  const int nTo,
527  const A_UTILS_NS::cString& strParent);
528 
535  tResult MoveDatatype(const int nFrom, const int nTo);
536 
543  tResult MoveComplexDataType(const int nFrom,
544  const int nTo);
545 
554  const int nTo,
555  const A_UTILS_NS::cString& strParent);
556 
563  tResult MoveStream(const int nFrom, const int nTo);
564 
574 
584 
594 
604 
605 
612  void CloneStreams(const tDDLStreamVec& vecStreams);
613 
620  void RefStreams(tDDLStreamVec& vecStreams);
621 
630  void MergeStreams(tDDLStreamVec vecStreams, uint32_t ui32JoinFlags = 0, tDDLVec* pvecDeleteData = NULL);
631 
639  void AddStream(cDDLStream* poStream, int nPos = -1);
640 
646 
651  const tDDLStreamVec& GetStreams() const;
652 
661 
669  const cDDLStream * GetStreamByName(const A_UTILS_NS::cString& strName) const;
670 
679  tResult RenameStream(const A_UTILS_NS::cString& strOldName, const A_UTILS_NS::cString& strNewName);
680 
689 
697 
705 
714  void MergeStreamMetaTypes(tDDLStreamMetaTypeVec vecStreams, uint32_t ui32JoinFlags = 0, tDDLVec* pvecDeleteData = NULL);
715 
723  void AddStreamMetaType(cDDLStreamMetaType* poStream, int nPos = -1);
724 
730 
736 
745 
754 
763  tResult RenameStreamMetaType(const A_UTILS_NS::cString& strOldName, const A_UTILS_NS::cString& strNewName);
764 
773 
780  tResult Merge(cDDLDescription &oDDL, uint32_t ui32JoinFlags = 0);
781 
792  tResult RestoreLevel (int const nLevel);
793 
803  static cDDLDescription * CreateDefault(int const nCreationLevel = 1, bool bSorted = true);
804 
811  static cDDLDescription * CreateDefault(double fVersion, int const nCreationLevel, bool bSorted = true);
812 
813  private: // methods
818 
833  template<typename T>
834  static bool MergePart(cDDLContainer<T> &vecMemberData,
835  cDDLContainer<T> &vecOtherData,
836  uint32_t ui32JoinFlags,
837  tDDLVec* pvecDeleteDataMem,
838  cDDLDescription* pDesc,
839  const bool& bRefs,
840  const bool& bDeleteNonOverwritten = false);
841 
842  private: // members
843  cDDLHeader * m_poHeader;
844  tDDLUnitVec m_vecDDLUnits;
845  tDDLBaseunitVec m_vecDDLBaseunits;
846  tDDLPrefixVec m_vecDDLPrefixes;
847  tDDLDTVec m_vecDDLDataTypes;
848  tDDLEnumVec m_vecDDLEnums;
849  tDDLComplexVec m_vecStructs;
850  tDDLStreamVec m_vecStreams;
851  tDDLStreamMetaTypeVec m_vecStreamMetaTypes;
852  bool m_bInitFlag;
853  bool m_bMergeDefaults;
854  };
855 
860  template < class vectorType > class cDDLAutoVec
861  {
862  private:
863  std::vector < vectorType* >* m_pSyncVec;
864  public:
869  cDDLAutoVec(std::vector< vectorType* >* pSyncVec)
870  {
871  Set(pSyncVec);
872  };
877  {
878  AutoDelete();
879  };
886  void Reset()
887  {
888  m_pSyncVec = NULL;
889  }
897  void Set(std::vector< vectorType* >* pSyncVec)
898  {
899  Reset();
900  m_pSyncVec = pSyncVec;
901  }
902  private:
906  void AutoDelete()
907  {
908  if (m_pSyncVec)
909  {
910  std::transform(m_pSyncVec->begin(), m_pSyncVec->end(), m_pSyncVec->begin(), cDDLDescription::DeleteChild< vectorType > );
911  }
912  }
913  };
914 
915 } // namespace adtf_ddl
916 
917 #endif // _DDL_DESCRIPTION_H_INCLUDED_
Abstract base class/interface for Visitor design-pattern.
This class template provides a auto deletion for DDL vector content like tDDLEnumVec,...
void Reset()
Reset the DDL vector pointer.
void AutoDelete()
Deletes the current set sync pointer to an DDL Vector.
cDDLAutoVec(std::vector< vectorType * > *pSyncVec)
CTOR.
void Set(std::vector< vectorType * > *pSyncVec)
Reset the DDL vector pointer and set the given one.
Representation of a base unit inside a DDL description.
Definition: ddlbaseunit.h:16
Representation for a complex datatype inside a DDL specification.
Definition: ddlcomplex.h:35
Utility class that stores DDL entities.
Definition: ddlcontainer.h:18
Representation for a (simple) data type inside a DDL description.
Definition: ddldatatype.h:19
Main class representing a whole DDL description.
cDDLHeader * GetHeader() const
Getter for the DDL header.
const cDDLComplex * GetStructByName(const A_UTILS_NS::cString &strName) const
Getter for a specific struct object.
void RefDatatypes(tDDLDTVec &vecDDLDataTypes)
Setter for the data types.
const A_UTILS_NS::cString & GetName() const
Getter for the name of the representation object.
tResult RemoveComplexDataType(const A_UTILS_NS::cString &strName)
Removes the specified complex data-type.
void MergeEnums(tDDLEnumVec vecDDLEnum, uint32_t ui32JoinFlags=0, tDDLVec *pvecDeleteData=NULL)
Merger for the constants.
tDDLUnitVec & GetUnits()
Getter for the units.
void ClonePrefixes(const tDDLPrefixVec &vecDDLPrefixes)
Setter for the prefixes.
void MergeDatatypes(tDDLDTVec vecDDLDataTypes, uint32_t ui32JoinFlags=0, tDDLVec *pvecDeleteData=NULL)
Merger for the data types.
tResult RestoreLevel(int const nLevel)
Deprecated, see IMediaDescriptionStack for the mechanism provided by the Media Description Service th...
tDDLPrefixVec GetPrefixes() const
Getter for the prefixes.
tDDLComplexVec & GetStructs()
Getter for the complex datatypes.
void RefBaseunits(tDDLBaseunitVec &vecDDLBaseunits)
Setter for the baseunits.
void RefEnums(tDDLEnumVec &vecDDLEnum)
Setter for the constants.
void CloneStructs(const tDDLComplexVec &vecStructs)
Setter for the complex datatypes.
tResult MoveBaseunit(const int nFrom, const int nTo)
Method moves the specified base unit.
void RefUnits(tDDLUnitVec &vecDDLUnits)
Setter for the units.
void CloneBaseunits(const tDDLBaseunitVec &vecDDLBaseunits)
Setter for the baseunits.
tResult RenameStreamMetaType(const A_UTILS_NS::cString &strOldName, const A_UTILS_NS::cString &strNewName)
Renames the specified stream.
void AddStruct(cDDLComplex *poStruct, int nPos=-1)
Adder for a complex datatype object.
tResult RemoveType(const A_UTILS_NS::cString &strName)
Removes the specified primitive or complex data-type.
void AddPrefix(cDDLPrefix *poPrefix, int nPos=-1)
Adder for a prefix object.
void RefStreamMetaTypes(tDDLStreamMetaTypeVec &vecStreams)
Setter for the streams.
void MergeBaseunits(tDDLBaseunitVec vecDDLBaseunits, uint32_t ui32JoinFlags=0, tDDLVec *pvecDeleteData=NULL)
Merger for the baseunits.
cDDLPrefix * GetPrefixByName(const A_UTILS_NS::cString &strName)
Getter for a specific prefix object.
bool IsInitialized() const
Getter for the initialization flag.
void RefPrefixes(tDDLPrefixVec &vecDDLPrefixes)
Setter for the prefixes.
void AddStreamMetaType(cDDLStreamMetaType *poStream, int nPos=-1)
Adder for a stream object.
const cDDLUnit * GetUnitByName(const A_UTILS_NS::cString &strName) const
Getter for a specific unit object.
void RefStreams(tDDLStreamVec &vecStreams)
Setter for the streams.
tResult Merge(cDDLDescription &oDDL, uint32_t ui32JoinFlags=0)
Merges another DDL into this one.
tResult MoveStream(const int nFrom, const int nTo)
Method moves the specified stream.
tDDLEnumVec & GetEnums()
Getter for the enums.
void MergeUnits(tDDLUnitVec vecDDLUnits, uint32_t ui32JoinFlags=0, tDDLVec *pvecDeleteData=NULL)
Merger for the units.
cDDLEnum * GetEnumByName(const A_UTILS_NS::cString &strName)
Getter for a specific enum object.
void MergeStreams(tDDLStreamVec vecStreams, uint32_t ui32JoinFlags=0, tDDLVec *pvecDeleteData=NULL)
Merger for the streams.
tResult RenameStream(const A_UTILS_NS::cString &strOldName, const A_UTILS_NS::cString &strNewName)
Renames the specified stream.
tResult RemoveEnum(const A_UTILS_NS::cString &strName)
Removes the specified enum.
void AddDatatype(cDDLDataType *poDatatype, int nPos=-1)
Adder for a datatype object.
tResult RemoveUnit(const A_UTILS_NS::cString &strName)
Removes the specified Unit type.
tResult MoveComplexDataType(const int nFrom, const int nTo)
Method moves the specified complex data-type.
void CloneUnits(const tDDLUnitVec &vecDDLUnits)
Setter for the units.
void CloneDatatypes(const tDDLDTVec &vecDDLDataTypes)
Setter for the data types.
void MergePrefixes(tDDLPrefixVec vecDDLPrefixes, uint32_t ui32JoinFlags=0, tDDLVec *pvecDeleteData=NULL)
Merger for the prefixes.
cDDLStream * GetStreamByName(const A_UTILS_NS::cString &strName)
Getter for a specific stream object.
tResult RemoveStream(const A_UTILS_NS::cString &strName)
Removes the specified stream from the description.
tResult MovePrefix(const int nFrom, const int nTo)
Method moves the specified prefix.
const cDDLBaseunit * GetBaseunitByName(const A_UTILS_NS::cString &strName) const
Getter for a specific baseunit object.
void AddEnum(cDDLEnum *poEnum, int nPos=-1)
Adder for a enum object.
static bool MergePart(cDDLContainer< T > &vecMemberData, cDDLContainer< T > &vecOtherData, uint32_t ui32JoinFlags, tDDLVec *pvecDeleteDataMem, cDDLDescription *pDesc, const bool &bRefs, const bool &bDeleteNonOverwritten=false)
Helper method to merge a vector of representation objects into the according vector inside another DD...
tDDLDTVec & GetDatatypes()
Getter for the datatypes.
void RefStructs(tDDLComplexVec &vecStructs)
Setter for the complex datatypes.
void AddBaseunit(cDDLBaseunit *poBaseunit, int nPos=-1)
Adder for a baseunit object.
void MergeStreamMetaTypes(tDDLStreamMetaTypeVec vecStreams, uint32_t ui32JoinFlags=0, tDDLVec *pvecDeleteData=NULL)
Merger for the streams.
tResult MoveRefUnit(const int nFrom, const int nTo, const A_UTILS_NS::cString &strParent)
Method moves the specified element within a unit.
void AddUnit(cDDLUnit *poUnit, int nPos=-1)
Adder for an unit object.
tDDLBaseunitVec GetBaseunits() const
Getter for the baseunits.
static cDDLDescription * CreateDefault(int const nCreationLevel=1, bool bSorted=true)
Method to create a default DDL description.
tResult MoveHeaderExcDec(const int nFrom, const int nTo)
Method moves the specified external header declaration.
tDDLStreamMetaTypeVec & GetStreamMetaTypes()
Getter for the streams.
tResult RemoveStreamMetaType(const A_UTILS_NS::cString &strName)
Removes the specified stream from the description.
tResult Accept(IDDLVisitor *poVisitor)
Acceptance method for Visitor design-pattern.
void CloneEnums(const tDDLEnumVec &vecDDLEnums)
Setter for the enums.
void MergeStructs(tDDLComplexVec vecStructs, uint32_t ui32JoinFlags=0, tDDLVec *pvecDeleteData=NULL)
Merger for the complex datatypes.
tResult MoveEnumElement(const int nFrom, const int nTo, const A_UTILS_NS::cString &strParent)
Method moves the specified enum element.
tResult MoveComplexDataTypeElement(const int nFrom, const int nTo, const A_UTILS_NS::cString &strParent)
Method moves the specified element within complex data-type.
tResult MoveDatatype(const int nFrom, const int nTo)
Method moves the specified data-type.
tResult RemoveDataType(const A_UTILS_NS::cString &strName)
Removes the specified primitive data-type.
void CloneStreams(const tDDLStreamVec &vecStreams)
Setter for the streams.
cDDLStreamMetaType * GetStreamMetaTypeByName(const A_UTILS_NS::cString &strName)
Getter for a specific stream object.
tResult MoveUnit(const int nFrom, const int nTo)
Method moves the specified unit.
tResult Create(cDDLHeader *poHeader, tDDLUnitVec vecDDLUnits=tDDLUnitVec(), tDDLBaseunitVec vecDDLBaseunits=tDDLBaseunitVec(), tDDLPrefixVec vecDDLPrefixes=tDDLPrefixVec(), tDDLDTVec vecDTs=tDDLDTVec(), tDDLComplexVec vecStructs=tDDLComplexVec(), tDDLStreamVec vecStreams=tDDLStreamVec(), tDDLEnumVec vecEnums=tDDLEnumVec())
Creation method to fill the object with data.
cDDLDataType * GetDataTypeByName(const A_UTILS_NS::cString &strName)
Getter for a specific data-type object.
void AddStream(cDDLStream *poStream, int nPos=-1)
Adder for a stream object.
tResult RemoveBaseunit(const A_UTILS_NS::cString &strName)
Removes the specified BaseUnit type.
void CloneStreamMetaTypes(const tDDLStreamMetaTypeVec &vecStreams)
Setter for the streams.
tResult RemovePrefix(const A_UTILS_NS::cString &strName)
Removes the specified Unit type.
tResult MoveEnum(const int nFrom, const int nTo)
Method moves the specified enum-type.
tDDLStreamVec & GetStreams()
Getter for the streams.
Representation for an enum inside a DDL description.
Definition: ddlenum.h:20
Representation of the header of a DDL description.
Definition: ddlheader.h:28
Representation of a prefix in a DDL description.
Definition: ddlprefix.h:17
Representation of a stream inside a DDL description.
Definition: ddlstream.h:28
Representation of a stream inside a DDL description.
Representation object of a unit.
Definition: ddlunit.h:28
ADTF A_UTIL Namespace - Within adtf this is used as adtf::util or adtf_util.
Definition: d_ptr.h:11
string_base< cStackString > cString
cString implementation for a stack string which works on stack if string is lower than A_UTILS_DEFAUL...
Definition: string.h:2778
tResult transform(const Decoder &oDecoder, Encoder &oEncoder)
Copies all elements from a decoder to a codec.
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.