PST SDK  5.2.0.0-0eac0f6
PSTech::Utils::PstVector< T > Class Template Reference

Basic vector class, cloning std::vector<T>. More...

#include <PstVector.h>

+ Collaboration diagram for PSTech::Utils::PstVector< T >:

Classes

class  Allocator
 

Public Types

typedef T value_type
 
typedef size_t size_type
 
typedef T * pointer
 
typedef T & reference
 
typedef T * iterator
 

Public Member Functions

 PstVector ()
 
 PstVector (size_type size)
 
 PstVector (size_type size, const_reference data)
 
 PstVector (const PstVector &vector)
 
 ~PstVector ()
 
size_type size () const
 
size_type capacity () const
 
bool empty () const
 
void reserve (size_type size)
 
void resize (size_type size)
 
void resize (size_type size, const_reference data)
 
void clear ()
 
void assign (size_type count, const_reference data)
 
void push_back (const_reference data)
 
void push_back (T &&data)
 
void pop_back ()
 
const_reference at (size_type index) const
 
reference at (size_type index)
 
const_reference front () const
 
reference front ()
 
const_reference back () const
 
reference back ()
 
const_iterator cbegin () const
 
const_iterator begin () const
 
iterator begin ()
 
const_iterator cend () const
 
const_iterator end () const
 
iterator end ()
 
const_reference operator[] (size_type index) const
 
reference operator[] (size_type index)
 

Public Attributes

const typedef T * const_pointer
 
const typedef T & const_reference
 
const typedef T * const_iterator
 

Private Member Functions

void resize_internal (size_type size, const_pointer data)
 
void check_bounds (size_type index) const
 

Private Attributes

size_type m_size
 
size_type m_allocated
 
pointer m_array
 
Allocator m_allocator
 

Detailed Description

template<typename T>
class PSTech::Utils::PstVector< T >

This class can safely be passed across the DLL boundary.

PstVector<T> has been defined for the following types:

Examples
trackingtarget.cpp.

Member Typedef Documentation

◆ iterator

template<typename T >
typedef T* PSTech::Utils::PstVector< T >::iterator

◆ pointer

template<typename T >
typedef T* PSTech::Utils::PstVector< T >::pointer

◆ reference

template<typename T >
typedef T& PSTech::Utils::PstVector< T >::reference

◆ size_type

template<typename T >
typedef size_t PSTech::Utils::PstVector< T >::size_type

◆ value_type

template<typename T >
typedef T PSTech::Utils::PstVector< T >::value_type

Constructor & Destructor Documentation

◆ PstVector() [1/4]

template<typename T >
PSTech::Utils::PstVector< T >::PstVector ( )

Default constructor creates empty PstVector of size 0

◆ PstVector() [2/4]

template<typename T >
PSTech::Utils::PstVector< T >::PstVector ( size_type  size)
explicit

Construct a PstVector of size size, using the default constructor of T

◆ PstVector() [3/4]

template<typename T >
PSTech::Utils::PstVector< T >::PstVector ( size_type  size,
const_reference  data 
)

Construct a PstVector of size size and filling it with copies of data

◆ PstVector() [4/4]

template<typename T >
PSTech::Utils::PstVector< T >::PstVector ( const PstVector< T > &  vector)

Copy constructor

◆ ~PstVector()

template<typename T >
PSTech::Utils::PstVector< T >::~PstVector ( )

Destructor

Member Function Documentation

◆ assign()

template<typename T >
void PSTech::Utils::PstVector< T >::assign ( size_type  count,
const_reference  data 
)

Fill the PstVector with ‘count’ copies of ‘data’. Resize the vector if ‘count’ differs from the current PstVector size.

◆ at() [1/2]

template<typename T >
reference PSTech::Utils::PstVector< T >::at ( size_type  index)

Get a reference to the item stored at position ‘índex’ in the PstVector with bounds check. If ‘index’ is larger than the size of the PstVector, a PSTech::OutOfRangeException is thrown.

Exceptions
PSTech::OutOfRangeException

◆ at() [2/2]

template<typename T >
const_reference PSTech::Utils::PstVector< T >::at ( size_type  index) const

Get a const reference to the item stored at position ‘índex’ in the PstVector with bounds check. If ‘index’ is larger than the size of the PstVector, a PSTech::OutOfRangeException is thrown.

Exceptions
PSTech::OutOfRangeException

◆ back() [1/2]

template<typename T >
reference PSTech::Utils::PstVector< T >::back ( )

Get a reference to the last element in the PstVector.

◆ back() [2/2]

template<typename T >
const_reference PSTech::Utils::PstVector< T >::back ( ) const

Get a const reference to the last element in the PstVector.

◆ begin() [1/2]

template<typename T >
iterator PSTech::Utils::PstVector< T >::begin ( )

Get an iterator to the beginning of the PstVector.

◆ begin() [2/2]

template<typename T >
const_iterator PSTech::Utils::PstVector< T >::begin ( ) const

Get a const iterator to the beginning of the PstVector.

◆ capacity()

template<typename T >
size_type PSTech::Utils::PstVector< T >::capacity ( ) const

Get the number of elements for which memory has been allocated.

Note
This is not the number of initialized elements in the PstVector.
See also
PstVector::size()

◆ cbegin()

template<typename T >
const_iterator PSTech::Utils::PstVector< T >::cbegin ( ) const

Get a const iterator to the beginning of the PstVector.

◆ cend()

template<typename T >
const_iterator PSTech::Utils::PstVector< T >::cend ( ) const

Get a const iterator to the end of the PstVector.

◆ check_bounds()

template<typename T >
void PSTech::Utils::PstVector< T >::check_bounds ( size_type  index) const
private

◆ clear()

template<typename T >
void PSTech::Utils::PstVector< T >::clear ( )

Destroy all elements of the PstVector and set its size to 0.

Note
This does not deallocate the memory allocated for this PstVector.

◆ empty()

template<typename T >
bool PSTech::Utils::PstVector< T >::empty ( ) const

Returns true if the PstVector is empty.

◆ end() [1/2]

template<typename T >
iterator PSTech::Utils::PstVector< T >::end ( )

Get an iterator to the end of the PstVector.

◆ end() [2/2]

template<typename T >
const_iterator PSTech::Utils::PstVector< T >::end ( ) const

Get a const iterator to the end of the PstVector.

◆ front() [1/2]

template<typename T >
reference PSTech::Utils::PstVector< T >::front ( )

Get a reference to the first element in the PstVector.

◆ front() [2/2]

template<typename T >
const_reference PSTech::Utils::PstVector< T >::front ( ) const

Get a const reference to the first element in the PstVector.

◆ operator[]() [1/2]

template<typename T >
reference PSTech::Utils::PstVector< T >::operator[] ( size_type  index)

Get a reference to the item stored at position ‘índex’ in the PstVector.

◆ operator[]() [2/2]

template<typename T >
const_reference PSTech::Utils::PstVector< T >::operator[] ( size_type  index) const

Get a const reference to the item stored at position ‘índex’ in the PstVector.

◆ pop_back()

template<typename T >
void PSTech::Utils::PstVector< T >::pop_back ( )

Destroy the last element from the back of the PstVector, decreasing its size by one.

◆ push_back() [1/2]

template<typename T >
void PSTech::Utils::PstVector< T >::push_back ( const_reference  data)

Add a copy of ‘data’ to the back of the PstVector, increasing its size by one. If not enough memory has been allocated to store the extra element, double the Pstvector size.

◆ push_back() [2/2]

template<typename T >
void PSTech::Utils::PstVector< T >::push_back ( T &&  data)

Move ‘data’ to the back of the PstVector, increasing its size by one. If not enough memory has been allocated to store the extra element, double the Pstvector size.

◆ reserve()

template<typename T >
void PSTech::Utils::PstVector< T >::reserve ( size_type  size)

Allocate space for a PstVector of size ‘size’. This function ensures that the PstVector has enough memory allocated to contain ‘size’ element, allocating more memory if needed.

Note
PstVector::reserve() can only increase the amount of allocated memory.
See also
PstVector::resize()

◆ resize() [1/2]

template<typename T >
void PSTech::Utils::PstVector< T >::resize ( size_type  size)

Allocate memory for a PstVector of size ‘size’ and initialize its elements using the defualt constructor of T.

See also
PstVector::resize(size_type size, const_reference data)
PstVector::reserve()

◆ resize() [2/2]

template<typename T >
void PSTech::Utils::PstVector< T >::resize ( size_type  size,
const_reference  data 
)

Allocate memory for a PstVector of size ‘size’ and initialize its elements using copies of ‘data’.

See also
PstVector::resize(size_type size)
PstVector::reserve()

◆ resize_internal()

template<typename T >
void PSTech::Utils::PstVector< T >::resize_internal ( size_type  size,
const_pointer  data 
)
private

◆ size()

template<typename T >
size_type PSTech::Utils::PstVector< T >::size ( ) const

Get the current size of the PstVector

Note
This returns the number of initialized elements in the PstVector, not the amount of allocated memory.
See also
PstVector::capacity()
Examples
trackingtarget.cpp.

Member Data Documentation

◆ const_iterator

template<typename T >
const typedef T* PSTech::Utils::PstVector< T >::const_iterator

◆ const_pointer

template<typename T >
const typedef T* PSTech::Utils::PstVector< T >::const_pointer

◆ const_reference

template<typename T >
const typedef T& PSTech::Utils::PstVector< T >::const_reference

◆ m_allocated

template<typename T >
size_type PSTech::Utils::PstVector< T >::m_allocated
private

◆ m_allocator

template<typename T >
Allocator PSTech::Utils::PstVector< T >::m_allocator
private

◆ m_array

template<typename T >
pointer PSTech::Utils::PstVector< T >::m_array
private

◆ m_size

template<typename T >
size_type PSTech::Utils::PstVector< T >::m_size
private

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