ICF 3.0.5.47
Technical documentation of ICF Libraries
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>

Collaboration diagram for istd::TPointerVector< Pointer, AccessAdapter >:

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.
 
int GetCount () const
 Get number of stored elements.
 
void SetCount (int count)
 Set number of elements.
 
void Reset ()
 Remove all elements.
 
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.
 
Pointer * GetAt (int index) const
 Get pointer at specified index.
 
const ElementTypeGetElementAt (int index) const
 Get element at specified index.
 
void SetElementAt (int index, const ElementType &element)
 Set element at specified index.
 
void RemoveAt (int index)
 Remove element at specified index.
 
bool Remove (Pointer *elementPtr)
 Remove element elementPtr.
 
Pointer * PopAt (int index)
 Pop element at specified index.
 
void PushBack (const ElementType &element)
 Add new element at the end of collection.
 
void InsertElementAt (int index, const ElementType &element)
 Insert element at specified position.
 
void SwapElements (int index1, int index2)
 Switch two elements.
 

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 51 of file TPointerVector.h.

Member Typedef Documentation

◆ ElementType

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

Definition at line 54 of file TPointerVector.h.

Member Enumeration Documentation

◆ anonymous enum

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

Invalid index in the vector.

Definition at line 56 of file TPointerVector.h.

Constructor & Destructor Documentation

◆ TPointerVector() [1/2]

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

Definition at line 158 of file TPointerVector.h.

◆ TPointerVector() [2/2]

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

Definition at line 164 of file TPointerVector.h.

◆ ~TPointerVector()

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

Definition at line 187 of file TPointerVector.h.

Member Function Documentation

◆ GetAt()

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

◆ GetCount()

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

◆ GetElementAt()

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 246 of file TPointerVector.h.

◆ HasElement()

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 220 of file TPointerVector.h.

◆ InsertElementAt()

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

Insert element at specified position.

Definition at line 320 of file TPointerVector.h.

◆ IsEmpty()

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 171 of file TPointerVector.h.

◆ PopAt()

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 299 of file TPointerVector.h.

◆ PushBack()

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 313 of file TPointerVector.h.

◆ Remove()

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 281 of file TPointerVector.h.

◆ RemoveAt()

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 267 of file TPointerVector.h.

◆ Reset()

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

Remove all elements.

Definition at line 207 of file TPointerVector.h.

◆ SetCount()

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

Set number of elements.

Definition at line 194 of file TPointerVector.h.

◆ SetElementAt()

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

Set element at specified index.

Definition at line 256 of file TPointerVector.h.

◆ SwapElements()

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 331 of file TPointerVector.h.


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

© Witold Gantzke and Kirill Lepskiy