Public Types | Public Member Functions | List of all members
istd::TPointerVector< Pointer, AccessAdapter > Class Template Reference

Implementation of a pointer container, which controls the live cycle of the pointer object. More...

#include <TPointerVector.h>

Public Types

enum  { InvalidIndex = -1 }
 
typedef AccessAdapter::ElementType ElementType
 

Public Member Functions

 TPointerVector ()
 
 TPointerVector (const TPointerVector &)
 
 ~TPointerVector ()
 
bool IsEmpty () const
 Check if there is element stored in this set. More...
 
int GetCount () const
 Get number of stored elements. More...
 
void SetCount (int count)
 Set number of elements. More...
 
void Reset ()
 Remove all elements. More...
 
int HasElement (const Pointer *elementPtr) const
 Check if some element is stored in this vector and return the index of the element, if anyone exists, otherwise return InvalidIndex. More...
 
Pointer * GetAt (int index) const
 Get pointer at specified index. More...
 
const ElementTypeGetElementAt (int index) const
 Get element at specified index. More...
 
void SetElementAt (int index, const ElementType &element)
 Set element at specified index. More...
 
void RemoveAt (int index)
 Remove element at specified index. More...
 
bool Remove (Pointer *elementPtr)
 Remove element elementPtr. More...
 
Pointer * PopAt (int index)
 Pop element at specified index. More...
 
void PushBack (const ElementType &element)
 Add new element at the end of collection. More...
 
void InsertElementAt (int index, const ElementType &element)
 Insert element at specified position. More...
 
void SwapElements (int index1, int index2)
 Switch two elements. More...
 

Detailed Description

template<typename Pointer, class AccessAdapter = TDeleteAdapter<Pointer>>
class istd::TPointerVector< Pointer, AccessAdapter >

Implementation of a pointer container, which controls the live cycle of the pointer object.

Definition at line 47 of file TPointerVector.h.

Member Typedef Documentation

template<typename Pointer, class AccessAdapter = TDeleteAdapter<Pointer>>
typedef AccessAdapter::ElementType istd::TPointerVector< Pointer, AccessAdapter >::ElementType

Definition at line 50 of file TPointerVector.h.

Member Enumeration Documentation

template<typename Pointer, class AccessAdapter = TDeleteAdapter<Pointer>>
anonymous enum
Enumerator
InvalidIndex 

Invalid index in the vector.

Definition at line 52 of file TPointerVector.h.

Constructor & Destructor Documentation

template<typename Pointer , class AccessAdapter >
istd::TPointerVector< Pointer, AccessAdapter >::TPointerVector ( )
inline

Definition at line 154 of file TPointerVector.h.

template<typename Pointer, class AccessAdapter = TDeleteAdapter<Pointer>>
istd::TPointerVector< Pointer, AccessAdapter >::TPointerVector ( const TPointerVector< Pointer, AccessAdapter > &  )
template<typename Pointer , class AccessAdapter >
istd::TPointerVector< Pointer, AccessAdapter >::~TPointerVector ( )

Definition at line 183 of file TPointerVector.h.

Member Function Documentation

template<typename Pointer , class AccessAdapter >
Pointer * istd::TPointerVector< Pointer, AccessAdapter >::GetAt ( int  index) const
template<typename Pointer , class AccessAdapter >
int istd::TPointerVector< Pointer, AccessAdapter >::GetCount ( ) const
inline
template<typename Pointer , class AccessAdapter >
const TPointerVector< Pointer, AccessAdapter >::ElementType & istd::TPointerVector< Pointer, AccessAdapter >::GetElementAt ( int  index) const

Get element at specified index.

Dependent on implementation of AccessAdapter it can differ from GetAt().

Definition at line 236 of file TPointerVector.h.

template<typename Pointer, class AccessAdapter >
int istd::TPointerVector< Pointer, AccessAdapter >::HasElement ( const Pointer *  elementPtr) const

Check if some element is stored in this vector and return the index of the element, if anyone exists, otherwise return InvalidIndex.

Definition at line 210 of file TPointerVector.h.

template<typename Pointer , class AccessAdapter >
void istd::TPointerVector< Pointer, AccessAdapter >::InsertElementAt ( int  index,
const ElementType element 
)

Insert element at specified position.

Definition at line 310 of file TPointerVector.h.

template<typename Pointer , class AccessAdapter >
bool istd::TPointerVector< Pointer, AccessAdapter >::IsEmpty ( ) const
inline

Check if there is element stored in this set.

Definition at line 167 of file TPointerVector.h.

template<typename Pointer , class AccessAdapter >
Pointer * istd::TPointerVector< Pointer, AccessAdapter >::PopAt ( int  index)

Pop element at specified index.

It does't delete pointed object, it removes it only from the vector.

Definition at line 289 of file TPointerVector.h.

template<typename Pointer , class AccessAdapter >
void istd::TPointerVector< Pointer, AccessAdapter >::PushBack ( const ElementType element)

Add new element at the end of collection.

Definition at line 303 of file TPointerVector.h.

Referenced by iqt2d::TShapeParamsGuiCompBase< Ui, Shape, ShapeModel >::CreateShapes().

template<typename Pointer, class AccessAdapter >
bool istd::TPointerVector< Pointer, AccessAdapter >::Remove ( Pointer *  elementPtr)

Remove element elementPtr.

The element will be deleted and removed from this vector. It means after call of this method number of elements will be decreased if pointer is found.

Returns
true, if element was removed, false elsewhere.

Definition at line 271 of file TPointerVector.h.

template<typename Pointer , class AccessAdapter >
void istd::TPointerVector< Pointer, AccessAdapter >::RemoveAt ( int  index)

Remove element at specified index.

The element will be deleted and removed from this vector. It means after call of this method number of elements will be decreased.

Definition at line 257 of file TPointerVector.h.

template<typename Pointer , class AccessAdapter >
void istd::TPointerVector< Pointer, AccessAdapter >::Reset ( )

Remove all elements.

Definition at line 197 of file TPointerVector.h.

template<typename Pointer , class AccessAdapter >
void istd::TPointerVector< Pointer, AccessAdapter >::SetCount ( int  count)

Set number of elements.

Definition at line 190 of file TPointerVector.h.

template<typename Pointer , class AccessAdapter >
void istd::TPointerVector< Pointer, AccessAdapter >::SetElementAt ( int  index,
const ElementType element 
)

Set element at specified index.

Definition at line 246 of file TPointerVector.h.

template<typename Pointer , class AccessAdapter >
void istd::TPointerVector< Pointer, AccessAdapter >::SwapElements ( int  index1,
int  index2 
)

Switch two elements.

This operation is done very performant without any allocation.

Definition at line 321 of file TPointerVector.h.


The documentation for this class was generated from the following file:

© 2007-2017 Witold Gantzke and Kirill Lepskiy