Loading...
Searching...
No Matches
PstVector< T > Class Template Reference

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

`#include <PstVector.h>`

Collaboration diagram for PstVector< T >:
[legend]

## Classes
class | Allocator

## Public Types
typedef T | value_type
typedef size_t | size_type
typedef T * | pointer
typedef const T * | const_pointer
typedef T & | reference
typedef const T & | const_reference
typedef T * | iterator
typedef const T * | const_iterator

## Public Member Functions
| PstVector ()
| PstVector (size_type size)
| PstVector (size_type size, const_reference data)
| PstVector (const PstVector &vector)
| PstVector (PstVector &&vector) noexcept
| ~PstVector ()
PstVector & | operator= (const PstVector &vector)
PstVector & | operator= (PstVector &&vector) noexcept
void | swap (PstVector &vector) noexcept
size_type | size () const
size_type | capacity () const
bool | empty () const
void | reserve (size_type size)
void | resize (size_type size, const_reference data)
void | clear ()
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 ()
void | resize_internal (size_type size, const_pointer data)
void | check_bounds (size_type index) const

## Public 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:

- float
- unsigned char*
- PstString
- PstArray<float, 3>
- pstsdk::Target
- pstsdk::TargetStatus
- pstsdk::TargetPose
- pstsdk::Point

## Member Typedef Documentation

## ◆ const_iterator

template<typename T>

typedef const T* const_iterator

## ◆ const_pointer

template<typename T>

typedef const T* const_pointer

## ◆ const_reference

template<typename T>

typedef const T& const_reference

## ◆ iterator

template<typename T>

typedef T* iterator

## ◆ pointer

template<typename T>

typedef T* pointer

## ◆ reference

template<typename T>

typedef T& reference

## ◆ size_type

template<typename T>

typedef size_t size_type

## ◆ value_type

template<typename T>

typedef T value_type

## Constructor & Destructor Documentation

## ◆ PstVector() [1/5]

template<typename T>

PstVector | ( |  | ) |

Default constructor creates empty PstVector of size 0

## ◆ PstVector() [2/5]

template<typename T>

PstVector | ( | size_type | size | ) |
| explicit

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

## ◆ PstVector() [3/5]

template<typename T>

PstVector | ( | size_type | size,
|  | const_reference | data )

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

## ◆ PstVector() [4/5]

template<typename T>

PstVector | ( | const PstVector< T > & | vector | ) |

Copy constructor

## ◆ PstVector() [5/5]

template<typename T>

PstVector | ( | PstVector< T > && | vector | ) |
| noexcept

Move constructor

## ◆ ~PstVector()

template<typename T>

~PstVector | ( |  | ) |

Destructor

## Member Function Documentation

## ◆ at() [1/2]

template<typename T>

reference 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 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 back | ( |  | ) |

Get a reference to the last element in the PstVector.

## ◆ back() [2/2]

template<typename T>

const_reference back | ( |  | ) | const

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

## ◆ begin() [1/2]

template<typename T>

iterator begin | ( |  | ) |

Get an iterator to the beginning of the PstVector.

## ◆ begin() [2/2]

template<typename T>

const_iterator begin | ( |  | ) | const

Get a const iterator to the beginning of the PstVector.

## ◆ capacity()

template<typename T>

size_type 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 cbegin | ( |  | ) | const

Get a const iterator to the beginning of the PstVector.

## ◆ cend()

template<typename T>

const_iterator cend | ( |  | ) | const

Get a const iterator to the end of the PstVector.

## ◆ check_bounds()

template<typename T>

void check_bounds | ( | size_type | index | ) | const

## ◆ clear()

template<typename T>

void 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 empty | ( |  | ) | const

Returns true if the PstVector is empty.

## ◆ end() [1/2]

template<typename T>

iterator end | ( |  | ) |

Get an iterator to the end of the PstVector.

## ◆ end() [2/2]

template<typename T>

const_iterator end | ( |  | ) | const

Get a const iterator to the end of the PstVector.

## ◆ front() [1/2]

template<typename T>

reference front | ( |  | ) |

Get a reference to the first element in the PstVector.

## ◆ front() [2/2]

template<typename T>

const_reference front | ( |  | ) | const

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

## ◆ operator=() [1/2]

template<typename T>

PstVector & operator= | ( | const PstVector< T > & | vector | ) |

Assignment operator

## ◆ operator=() [2/2]

template<typename T>

PstVector & operator= | ( | PstVector< T > && | vector | ) |
| noexcept

Move assignment operator

## ◆ pop_back()

template<typename T>

void pop_back | ( |  | ) |

Fill the PstVector with count' copies of data'. Resize the vector if `count' differs from the current PstVector size. */ void assign(size_type count, 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. */ void push_back(const_reference 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. */ void push_back(T&& data);

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

## ◆ reserve()

template<typename T>

void 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()

template<typename T>

void resize | ( | size_type | size,
|  | const_reference | data )

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() */ void resize(size_type size);

/** 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 resize_internal | ( | size_type | size,
|  | const_pointer | data )

## ◆ size()

template<typename T>

size_type 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()

## ◆ swap()

template<typename T>

void swap | ( | PstVector< T > & | vector | ) |
| noexcept

Swaps the contents of the Pstvector with vector.

## Member Data Documentation

## ◆ m_allocated

template<typename T>

size_type m_allocated

## ◆ m_allocator

template<typename T>

Allocator m_allocator

## ◆ m_array

template<typename T>

pointer m_array

## ◆ m_size

template<typename T>

size_type m_size

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

- include/PstVector.h