VectorBase< T > Class Template Reference

`#include <Vector.h>`

Inheritance diagram for VectorBase< T >:

## Public Member Functions

size_t | size () const
size_t | bytes () const
void | resize (size_t newElements)
void | clear ()
void | clone (const VectorBase< T > &other)
void | vConcat (const VectorBase< T > &other1, const VectorBase< T > &other2)
| ~VectorBase ()
bool | isOwner ()
std::string | inspect () const
void | copyToSegment (VectorBase< T > &other, size_t start, size_t span) const
void | copyToSegment (VectorBase< T > &other, size_t start=0) const
void | copyTo (VectorBase< T > &other) const
void | segmentCopyTo (VectorBase< T > &other, size_t start, size_t span) const
void | fill (const T &val)
void | fill (const T &val, unsigned start, unsigned length)
void | operator= (const VectorBase< T > &other)
T & | operator[] (size_t index)
const T & | operator[] (size_t index) const
const T * | begin () const
T * | begin ()
const T * | end () const
T * | end ()
const T * | getData () const

## Protected Types

typedef T * | VectorDataType

## Protected Member Functions

void | vInit (size_t elements)
void | shiftMem (VectorBase< T > &other)
void | makeAlias (const VectorBase< T > &other)
| VectorBase ()
| VectorBase (VectorDataType wData, T *wStart, T *wEnd)

## Protected Attributes

VectorDataType | mData
| allocated data block.
T * | mStart
| start of useful data
T * | mEnd
| end of useful data + 1

## Detailed Description

template<class T>
class VectorBase< T >

A simplified Vector template with aliases. Unlike std::vector, this class does not support dynamic resizing. Unlike std::vector, this class does support "aliases" and subvectors.

## Member Typedef Documentation

## VectorDataType

template<class T >

typedef T* VectorBase< T >::VectorDataType

protected

## Constructor & Destructor Documentation

## VectorBase() [1/2]

template<class T >

VectorBase< T >::VectorBase | ( |  | ) |

inline protected

## VectorBase() [2/2]

template<class T >

VectorBase< T >::VectorBase | ( | VectorDataType | wData,
|  | T * | wStart,
|  | T * | wEnd
| ) |  |

inline protected

Build a Vector with explicit values.

References VectorBase< T >::getData(), and VECTORDEBUG.

## ~VectorBase()

template<class T >

VectorBase< T >::~VectorBase | ( |  | ) |

inline

Destroy a Vector, deleting held memory.

References VectorBase< T >::clear(), and VECTORDEBUG.

## Member Function Documentation

## begin() [1/2]

template<class T >

T * VectorBase< T >::begin | ( |  | ) |

inline

References VectorBase< T >::mStart.

## begin() [2/2]

template<class T >

const T * VectorBase< T >::begin | ( |  | ) | const

inline

References VectorBase< T >::mStart.

## bytes()

template<class T >

size_t VectorBase< T >::bytes | ( |  | ) | const

inline

Return size in bytes.

References VectorBase< T >::size().

Referenced by VectorBase< T >::clone(), and VectorBase< T >::vConcat().

## clear()

template<class T >

void VectorBase< T >::clear | ( |  | ) |

inline

Release memory and clear pointers.

References VectorBase< T >::resize().

Referenced by VectorBase< T >::makeAlias(), VectorBase< T >::shiftMem(), and VectorBase< T >::~VectorBase().

## clone()

template<class T >

void VectorBase< T >::clone | ( | const VectorBase< T > & | other | ) |

inline

Copy data from another vector.

References VectorBase< T >::bytes(), VectorBase< T >::mData, VectorBase< T >::mStart, VectorBase< T >::resize(), and VectorBase< T >::size().

Referenced by BitVector::cloneSegment(), Vector< T >::operator=(), VectorBase< T >::operator=(), and Vector< T >::Vector().

## copyTo()

template<class T >

void VectorBase< T >::copyTo | ( | VectorBase< T > & | other | ) | const

inline

References VectorBase< T >::copyToSegment(), and VectorBase< T >::size().

## copyToSegment() [1/2]

template<class T >

void VectorBase< T >::copyToSegment | ( | VectorBase< T > & | other,
|  | size_t | start,
|  | size_t | span
| ) |  | const

inline

Copy part of this Vector to a segment of another Vector.

Parameters

  other | The other vector.
  start | The start point in the other vector.
  span | The number of elements to copy.

References VectorBase< T >::mEnd, and VectorBase< T >::mStart.

Referenced by VectorBase< T >::copyTo().

## copyToSegment() [2/2]

template<class T >

void VectorBase< T >::copyToSegment | ( | VectorBase< T > & | other,
|  | size_t | start = `0`
| ) |  | const

inline

Copy all of this Vector to a segment of another Vector.

References VectorBase< T >::copyToSegment(), and VectorBase< T >::size().

Referenced by VectorBase< T >::copyToSegment().

## end() [1/2]

template<class T >

T * VectorBase< T >::end | ( |  | ) |

inline

References VectorBase< T >::mEnd.

## end() [2/2]

template<class T >

const T * VectorBase< T >::end | ( |  | ) | const

inline

References VectorBase< T >::mEnd.

Referenced by VectorBase< T >::fill().

## fill() [1/2]

template<class T >

void VectorBase< T >::fill | ( | const T & | val | ) |

inline

References VectorBase< T >::mEnd, and VectorBase< T >::mStart.

Referenced by SoftVector::unknown().

## fill() [2/2]

template<class T >

void VectorBase< T >::fill | ( | const T & | val,
|  | unsigned | start,
|  | unsigned | length
| ) |  |

inline

References VectorBase< T >::end(), VectorBase< T >::mEnd, and VectorBase< T >::mStart.

## getData()

template<class T >

const T * VectorBase< T >::getData | ( |  | ) | const

inline

References VectorBase< T >::mData.

Referenced by BitVector::BitVector(), VectorBase< T >::makeAlias(), VectorBase< T >::operator=(), and VectorBase< T >::VectorBase().

## inspect()

template<class T >

std::string VectorBase< T >::inspect | ( |  | ) | const

inline

References VectorBase< T >::mData, VectorBase< T >::mEnd, and VectorBase< T >::mStart.

## isOwner()

template<class T >

bool VectorBase< T >::isOwner | ( |  | ) |

inline

References VectorBase< T >::mData.

## makeAlias()

template<class T >

void VectorBase< T >::makeAlias | ( | const VectorBase< T > & | other | ) |

inline protected

References VectorBase< T >::clear(), VectorBase< T >::getData(), VectorBase< T >::mEnd, and VectorBase< T >::mStart.

Referenced by VectorBase< T >::operator=().

## operator=()

template<class T >

void VectorBase< T >::operator= | ( | const VectorBase< T > & | other | ) |

inline

Assign from another Vector.

References VectorBase< T >::clone(), VectorBase< T >::getData(), and VectorBase< T >::makeAlias().

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

template<class T >

T & VectorBase< T >::operator[] | ( | size_t | index | ) |

inline

References VectorBase< T >::mEnd, and VectorBase< T >::mStart.

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

template<class T >

const T & VectorBase< T >::operator[] | ( | size_t | index | ) | const

inline

References VectorBase< T >::mEnd, and VectorBase< T >::mStart.

## resize()

template<class T >

void VectorBase< T >::resize | ( | size_t | newElements | ) |

inline

Change the size of the Vector in items (not bytes), discarding content.

References VectorBase< T >::mData, VECTORDEBUG, and VectorBase< T >::vInit().

Referenced by VectorBase< T >::clear(), VectorBase< T >::clone(), VectorBase< T >::vConcat(), and Vector< T >::Vector().

## segmentCopyTo()

template<class T >

void VectorBase< T >::segmentCopyTo | ( | VectorBase< T > & | other,
|  | size_t | start,
|  | size_t | span
| ) |  | const

inline

Copy a segment of this vector into another.

Parameters

  other | The other vector (to copt into starting at 0.)
  start | The start point in this vector.
  span | The number of elements to copy. WARNING: This function does NOT resize the result - you must set the result size before entering.

References VectorBase< T >::mEnd, and VectorBase< T >::mStart.

## shiftMem()

template<class T >

void VectorBase< T >::shiftMem | ( | VectorBase< T > & | other | ) |

inline protected

Assign from another Vector, shifting ownership.

References VectorBase< T >::clear(), VectorBase< T >::mData, VectorBase< T >::mEnd, VectorBase< T >::mStart, and VECTORDEBUG.

Referenced by Vector< T >::operator=().

## size()

template<class T >

size_t VectorBase< T >::size | ( |  | ) | const

inline

Return the size of the Vector in units, ie, the number of T elements.

References VectorBase< T >::mData, VectorBase< T >::mEnd, and VectorBase< T >::mStart.

Referenced by SoftVector::alias(), VectorBase< T >::bytes(), VectorBase< T >::clone(), VectorBase< T >::copyTo(), VectorBase< T >::copyToSegment(), operator<<(), SoftVector::tail(), Vector< T >::tail(), SoftVector::tail(), Vector< T >::tail(), and VectorBase< T >::vConcat().

## vConcat()

template<class T >

void VectorBase< T >::vConcat | ( | const VectorBase< T > & | other1,
|  | const VectorBase< T > & | other2
| ) |  |

inline

References VectorBase< T >::bytes(), VectorBase< T >::mStart, VectorBase< T >::resize(), and VectorBase< T >::size().

Referenced by Vector< T >::Vector().

## vInit()

template<class T >

void VectorBase< T >::vInit | ( | size_t | elements | ) |

inline protected

References VectorBase< T >::mData, VectorBase< T >::mEnd, and VectorBase< T >::mStart.

Referenced by VectorBase< T >::resize().

## Member Data Documentation

## mData

template<class T >

VectorDataType VectorBase< T >::mData

protected

allocated data block.

Referenced by VectorBase< T >::clone(), VectorBase< T >::getData(), VectorBase< T >::inspect(), VectorBase< T >::isOwner(), VectorBase< T >::resize(), VectorBase< T >::shiftMem(), VectorBase< T >::size(), Vector< T >::Vector(), and VectorBase< T >::vInit().

## mEnd

template<class T >

T* VectorBase< T >::mEnd

protected

end of useful data + 1

Referenced by SoftVector::bit(), VectorBase< T >::copyToSegment(), VectorBase< T >::end(), VectorBase< T >::end(), VectorBase< T >::fill(), VectorBase< T >::fill(), VectorBase< T >::inspect(), VectorBase< T >::makeAlias(), VectorBase< T >::operator[](), VectorBase< T >::operator[](), SoftVector::segment(), Vector< T >::segment(), Vector< T >::segment(), VectorBase< T >::segmentCopyTo(), SoftVector::settfb(), VectorBase< T >::shiftMem(), VectorBase< T >::size(), SoftVector::softbit(), and VectorBase< T >::vInit().

## mStart

template<class T >

T* VectorBase< T >::mStart

protected

start of useful data

Referenced by VectorBase< T >::begin(), VectorBase< T >::begin(), SoftVector::bit(), VectorBase< T >::clone(), VectorBase< T >::copyToSegment(), BitVector::dup(), BitVector::dup(), VectorBase< T >::fill(), VectorBase< T >::fill(), VectorBase< T >::inspect(), VectorBase< T >::makeAlias(), VectorBase< T >::operator[](), VectorBase< T >::operator[](), SoftVector::segment(), VectorBase< T >::segmentCopyTo(), SoftVector::settfb(), VectorBase< T >::shiftMem(), VectorBase< T >::size(), SoftVector::softbit(), VectorBase< T >::vConcat(), and VectorBase< T >::vInit().

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

- Vector.h