ADTF  3.18.2
ddlcontainer.h
Go to the documentation of this file.
1 
7 #ifndef _DDL_CONTAINER_H_INCLUDED_
8 #define _DDL_CONTAINER_H_INCLUDED_
9 
10 namespace adtf_ddl
11 {
12 
16 template <typename T>
18 {
19  private:
20  std::vector<T*> m_vecPointers;
21  bool m_bSorted;
22 
23  #if defined(WIN32) && ((_MSC_VER < 1600) || defined(_DEBUG))
24  static T* s_pEmptyDummy;
25  #endif
26 
27  public:
28 
30  typedef T** iterator;
31 
33  typedef T* const * const_iterator;
34 
35  public:
36 
41  cDDLContainerNoClone(bool bSorted = true);
42 
49  void Insert(T* pElem, int nPos = -1);
50 
56  T* Find(const A_UTILS_NS::cString& strName);
57 
64 
70  const T* Find(const A_UTILS_NS::cString& strName) const;
71 
78 
82  void Delete();
83 
87  void Sort();
88 
93  bool IsSorted() const;
94 
100 
106 
112 
118 
122  void clear();
123 
130 
137  iterator erase(iterator itPosFirst, iterator itPosLast);
138 
143  bool empty() const;
144 
149  unsigned int size() const; // for compatibility reasons
150 
156  T*& operator[] (unsigned int nPos);
157 
163  T* const& operator[] (unsigned int nPos) const;
164 
170  T*& at(unsigned int nPos);
171 
177  T* const& at(unsigned int nPos) const;
178 };
179 
183 template <typename T>
185 {
186  public:
191  cDDLContainer(bool bSorted = true);
192 
198  void CloneFrom(const cDDLContainer& oOther);
199 };
200 
205 
238 
267 
271 typedef std::map<A_UTILS_NS::cString, cDDLStream*> tDDLStreamMap;
272 
276 typedef tDDLStreamMap::iterator tDDLStreamMapIt;
277 
278 }
279 
280 #endif
281 
Utility class to store DDL elements that can be cloned.
Definition: ddlcontainer.h:185
cDDLContainer(bool bSorted=true)
Constructor.
void CloneFrom(const cDDLContainer &oOther)
Clones all elements of a given container.
Utility class that stores DDL entities.
Definition: ddlcontainer.h:18
void Insert(T *pElem, int nPos=-1)
Insert.
iterator erase(iterator itPos)
removes an element from the container
const_iterator begin() const
Returns an iterator to the first element.
T *& operator[](unsigned int nPos)
random access operator.
bool empty() const
Returns whether the container is empty or not.
T *const & at(unsigned int nPos) const
random access method.
unsigned int size() const
Returns the size of the container.
iterator erase(iterator itPosFirst, iterator itPosLast)
removes a sequence of elements from the container
T *const * const_iterator
const iterator for DDL container
Definition: ddlcontainer.h:33
void CopyFromRef(cDDLContainerNoClone &oOther)
Copies the pointers from the other container.
bool IsSorted() const
Returns Whether or not the container is sorted by name or not.
T *& at(unsigned int nPos)
random access method.
void Delete()
Deletes all stored items (by calling delete on the pointers)
void clear()
clears the container (does not destroy the elements)
iterator end()
Returns an iterator to the element after the last element.
const_iterator end() const
Returns an iterator to the element after the last element.
const T * Find(const A_UTILS_NS::cString &strName) const
Finds an element by name.
iterator begin()
Returns an iterator to the first element.
cDDLContainerNoClone(bool bSorted=true)
Constructor.
iterator FindIt(const A_UTILS_NS::cString &strName)
Finds an element by name.
void Sort()
Sort the items by name.
T ** iterator
iterator for DDL container
Definition: ddlcontainer.h:30
T * Find(const A_UTILS_NS::cString &strName)
Finds an element by name.
Namespace for the mainpage_pkg_ddl.
cDDLContainerNoClone< IDDL > tDDLVec
Container type of basic DDL objects.
Definition: ddlcontainer.h:204
cDDLContainer< cDDLUnit > tDDLUnitVec
Container type of cDDLUnit objects.
Definition: ddlcontainer.h:209
cDDLContainer< cDDLBaseunit > tDDLBaseunitVec
Container type of cDDLBaseunit objects.
Definition: ddlcontainer.h:213
tDDLUnitVec::iterator tDDLUnitIt
Iterator type for tDDLUnitVec.
Definition: ddlcontainer.h:242
cDDLContainer< cDDLPrefix > tDDLPrefixVec
Container type of cDDLPrefix objects.
Definition: ddlcontainer.h:217
cDDLContainer< cDDLDataType > tDDLDTVec
Container type of cDDLDataType objects.
Definition: ddlcontainer.h:221
tDDLEnumVec::iterator tDDLEnumIt
Iterator type for tDDLConstVec.
Definition: ddlcontainer.h:258
std::map< A_UTILS_NS::cString, cDDLStream * > tDDLStreamMap
Associative container type for cDDLStream objects.
Definition: ddlcontainer.h:271
cDDLContainer< cDDLComplex > tDDLComplexVec
Container type of cDDLComplex objects.
Definition: ddlcontainer.h:229
tDDLDTVec::iterator tDDLDTIt
Iterator type for tDDLDTVec.
Definition: ddlcontainer.h:254
tDDLBaseunitVec::iterator tDDLBaseunitIt
Iterator type for tDDLBaseunitVec.
Definition: ddlcontainer.h:246
tDDLPrefixVec::iterator tDDLPrefixIt
Iterator type for tDDLPrefixVec.
Definition: ddlcontainer.h:250
tDDLStreamMap::iterator tDDLStreamMapIt
Iterator type for tDDLStreamMap.
Definition: ddlcontainer.h:276
tDDLComplexVec::iterator tDDLComplexIt
Iterator type for tDDLComplexVec.
Definition: ddlcontainer.h:262
tDDLStreamVec::iterator tDDLStreamIt
Iterator type for tDDLStreamVec.
Definition: ddlcontainer.h:266
cDDLContainer< cDDLStreamMetaType > tDDLStreamMetaTypeVec
Container type of cDDLStreamMetaType objects.
Definition: ddlcontainer.h:237
cDDLContainer< cDDLEnum > tDDLEnumVec
Container type of cDDLEnum objects.
Definition: ddlcontainer.h:225
cDDLContainer< cDDLStream > tDDLStreamVec
Container type of cDDLStream objects.
Definition: ddlcontainer.h:233