template <class T> class CWVec

Copy on write data vector class template.

Public Methods

explicit CWVec(size_t L=0)
Basic constructor
CWVec(const CWVec<T>& x)
Copy constructor.
CWVec(const CWVec<T>& x, size_t len)
Limited copy constructor.
~CWVec(void)
Destructor.
CWVec* Clone(void)
Create a new read instance.
CWVec* Access(void)
Request a writeable copy of the data vector.
CWVec* Access(size_t len)
Request a writeable copy of the data vector.
void Release(void)
Release a read instance
size_t getSize(void) const
Get the CW vector size.
const T* getRef(void) const
Get a constant reference to the data vector.
T* getRef(void)
Get a writable reference to the data vector.
const T& operator[](int i) const
Get a constant reference to a data word.
T& operator[](int i)
Get a writable reference to a data word.

Documentation

The CWVec classes allow data to be shared by more than one Data vector without forcing a copy. This is especially useful for reducing overheads when passing ownership of long data vectors. A data vector can be copied using the Clone() method, and when write access is needed, Access() is used.
explicit CWVec(size_t L=0)
Basic constructor

CWVec(const CWVec<T>& x)
Copy constructor.

CWVec(const CWVec<T>& x, size_t len)
Constructor a new CWVec identical to the first argument, but copy only the specified number of data words.

~CWVec(void)
Delete the vector.

CWVec* Clone(void)
Get a read-only copy of the pointer.
Returns:
A read-Only pointer.

CWVec* Access(void)
Get a pointer to a writeable copy of the vector. This function results in copying the vector if there is more than one user of this data.
Returns:
Pointer to a writeable CWVec with the same contents.

CWVec* Access(size_t len)
Return a pointer to a writeable copy of the data vector. If the vector is currently in use in other paces, the vector is copied and a pointer to the new vector is obtained.

void Release(void)
Release a read instance

size_t getSize(void) const
Get the number of words allocated by the CW vector.

const T* getRef(void) const
Get a constant reference to the data vector.

T* getRef(void)
Get a writable reference to the data vector.

const T& operator[](int i) const
Get a constant reference to a data word.

T& operator[](int i)
Get a writable reference to a data word.


This class has no child classes.

alphabetic index hierarchy of classes


generated by doc++