Robox Library for Cpp: BCC/31 module 1.0.0
RLibCpp BCC/31 protocol implementation
Classes | Public Types | Public Member Functions | List of all members
Variable::Data::PtrVector Class Reference

Class to handle with lists of Data pointers. More...

#include <variable.h>

Classes

class  PtrPtrVector
 Class to handle with lists of pointers to list of Data pointers. More...
 

Public Types

typedef PtrVectorpPtrVector
 

Public Member Functions

 PtrVector ()
 Default constructor.
 
 PtrVector (const PtrVector &src)
 Copy constructor.
 
virtual ~PtrVector ()
 Virtual destructor.
 
PtrVectoroperator= (const PtrVector &src)
 Assigment operator overload.
 
Dataoperator[] (size_t n)
 Returns a reference to the element at position n in the vector container.
 
const Dataoperator[] (size_t n) const
 Returns a reference to the element at position n in the vector container.
 
Dataat (size_t n)
 Returns a reference to the element at position n in the vector container.
 
const Dataat (size_t n) const
 Returns a reference to the element at position n in the vector container.
 
Datafront () const
 Get a reference to the first element in the container.
 
Databack () const
 Get a reference to the last element in the container.
 
void pushBack (const pData &value)
 Appends the given element value to the end of the container.
 
void popBack ()
 Removes the last element of the container.
 
void resize (size_t count)
 Resizes the container to contain count elements. The new element will be initialized with default values.
 
void resize (size_t count, const pData &value)
 Resizes the container to contain count elements.
 
size_t size () const
 Get the number of elements in the container.
 
void clear ()
 Erases all elements from the container. After this call, size() returns zero.
 

Detailed Description

Class to handle with lists of Data pointers.

Member Typedef Documentation

◆ pPtrVector

Constructor & Destructor Documentation

◆ PtrVector() [1/2]

PtrVector ( )

Default constructor.

◆ PtrVector() [2/2]

PtrVector ( const PtrVector & src)

Copy constructor.

Stored object copied from src will NOT be deleted upon clear or object deletion even if subsequently added with push commands

◆ ~PtrVector()

virtual ~PtrVector ( )
virtual

Virtual destructor.

This method will delete the stored object too, unless it was create with copy constructor PtrVector(const PtrVector& src) or assigned from other object operator=(const PtrVector& src)

Member Function Documentation

◆ at() [1/2]

Data * at ( size_t n)

Returns a reference to the element at position n in the vector container.

Parameters
nPosition of an element in the container.
Returns
The element at the specified position in the vector.

◆ at() [2/2]

const Data * at ( size_t n) const

Returns a reference to the element at position n in the vector container.

Parameters
nPosition of an element in the container.
Returns
The element at the specified position in the vector.

◆ back()

Data * back ( ) const

Get a reference to the last element in the container.

Returns
A reference to the last element in the container.

◆ clear()

void clear ( )

Erases all elements from the container. After this call, size() returns zero.

This method will delete the stored object too, unless it was create with copy constructor PtrVector(const PtrVector& src) or assigned from other object operator=(const PtrVector& src)

◆ front()

Data * front ( ) const

Get a reference to the first element in the container.

Returns
a reference to the first element in the container.

◆ operator=()

PtrVector & operator= ( const PtrVector & src)

Assigment operator overload.

Parameters
srcThe source object
Returns
A reference to this object

Stored object copied from src will NOT be deleted upon clear or object deletion even if subsequently added with push commands

◆ operator[]() [1/2]

Data * operator[] ( size_t n)

Returns a reference to the element at position n in the vector container.

Parameters
nPosition of an element in the container.
Returns
The element at the specified position in the vector.

◆ operator[]() [2/2]

const Data * operator[] ( size_t n) const

Returns a reference to the element at position n in the vector container.

Parameters
nPosition of an element in the container.
Returns
The element at the specified position in the vector.

◆ popBack()

void popBack ( )

Removes the last element of the container.

◆ pushBack()

void pushBack ( const pData & value)

Appends the given element value to the end of the container.

Parameters
valueThe value of the element to append

Stored object value will be deleted upon clear or object deletion unless this container was create with copy constructor PtrVector(const PtrVector& src) or assigned from other object operator=(const PtrVector& src)

◆ resize() [1/2]

void resize ( size_t count)

Resizes the container to contain count elements. The new element will be initialized with default values.

Parameters
countThe new size of the container

◆ resize() [2/2]

void resize ( size_t count,
const pData & value )

Resizes the container to contain count elements.

Parameters
countThe new size of the container
valueThe value to initialize the new elements with

◆ size()

size_t size ( ) const

Get the number of elements in the container.

Returns
The number of elements in the container