13#include "ObjectIDDecorator.h"
19 template<
class Collection_Type,
class Value_Type>
24 using collection_type = Collection_Type;
25 using value_type = Value_Type;
29 template<
typename _value_type,
typename _std_iterator_type>
35 using iterator_category = std::bidirectional_iterator_tag;
36 using value_type = _value_type;
37 using difference_type = int;
38 using distance_type = int;
39 using pointer = std::shared_ptr<_value_type>;
40 using reference = _value_type&;
44 inline iterator_imp(
const _std_iterator_type& iter ) noexcept
51 inline bool operator==(
const iterator_imp& iter )
const noexcept{
52 return m_Current == iter.m_Current;
55 inline bool operator!=(
const iterator_imp& iter )
const noexcept{
56 return m_Current != iter.m_Current;
59 inline iterator_imp& operator++()
noexcept{
64 inline iterator_imp operator++(
int)
noexcept{
65 iterator_imp retval( *
this );
70 inline iterator_imp& operator--()
noexcept{
75 inline iterator_imp operator--(
int)
noexcept{
76 iterator_imp retval( *
this );
81 inline reference operator*()
const noexcept{
82 return *m_Current->second;
85 inline pointer operator->()
const noexcept{
86 return m_Current->second;
90 _std_iterator_type m_Current;
99 virtual const char*
TypeName() const noexcept = 0;
133 virtual
bool Remove( Value_Type* pValue_Type,
bool zeroIDs = false ) = 0;
142 virtual
int Take( Collection_Type& collection_Type ) = 0;
158 virtual const_iterator
begin() const = 0;
160 virtual const_iterator cbegin() const = 0;
164 virtual iterator
end() = 0;
168 virtual const_iterator
end() const = 0;
170 virtual const_iterator cend() const = 0;
180 virtual
std::shared_ptr<Value_Type>
GetNext( const
std::shared_ptr<Value_Type>& pValue_Type ) const = 0;
190 virtual
std::shared_ptr<Value_Type>
GetPrevious( const
std::shared_ptr<Value_Type>& pValue_Type ) const = 0;
199 virtual
std::shared_ptr<Value_Type> Get(
IDType id ) const = 0;
201 virtual
std::shared_ptr<Value_Type> Get( const
std::
string& name ) const = 0;
229 virtual
bool IsMember( const value_type& item ) const = 0;
231 virtual
bool IsMember(
IDType id ) const = 0;
254 virtual ~Collection() = default;
255 Collection( const Collection& ) = delete;
256 Collection( Collection&& ) = delete;
257 Collection& operator=( const Collection& ) = delete;
258 Collection& operator=( Collection&& ) = delete;
260 Collection() = default;
263 virtual
void SetDecorator( Collection_Type* pCollection_TypeDecorator ) = 0;
Definition Collection.h:30
The base for decorator implementations. Needed as BaseDecorator to combine other decorator implemente...
Definition ObjectIDDecorator.h:27
Namespace of all the trax track libraries classes and methods.
Definition Collection.h:17
virtual std::shared_ptr< Value_Type > GetActive() const =0
virtual std::shared_ptr< Value_Type > GetLast() const =0
virtual bool IsValid() const noexcept=0
Checks whether the elements in this collection are valid.
virtual IDType MinID() const =0
virtual std::shared_ptr< Value_Type > GetNext(const std::shared_ptr< Value_Type > &pValue_Type) const =0
virtual iterator begin()=0
virtual IDType AddRelaxed(std::shared_ptr< Value_Type > pTraxType)=0
Adds an element to the container and returns its index in the container. Does not throw.
virtual int Take(Collection_Type &collection_Type)=0
Moves all the items from another container to this container.
virtual void PushActive(IDType id)=0
Pushes an element on the activety stack.
virtual bool Remove(Value_Type *pValue_Type, bool zeroIDs=false)=0
Removes an element from this container.
virtual void PopActive()=0
Pops an element from the activity stack.
virtual std::shared_ptr< Value_Type > GetPrevious(const std::shared_ptr< Value_Type > &pValue_Type) const =0
virtual int Count() const =0
virtual IDType MaxID() const =0
virtual void Clear()=0
Removes all the elements from this container.
virtual IDType Add(std::shared_ptr< Value_Type > pValue_Type)=0
Adds an element to the container and returns its index in the container.
virtual const char * TypeName() const noexcept=0
virtual void ShiftIDs(int offset)=0
Adds an offset to all ids.
virtual std::shared_ptr< Value_Type > GetFirst() const =0
Type used for IDs in the trax library.
Definition IDType.h:43