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

References mData, mEnd, and mStart.

Referenced by clone(), copyTo(), copyToSegment(), copyToSegment(), makeAlias(), operator=(), segmentCopyTo(), shiftMem(), vConcat(), Vector< T >::Vector(), Vector< T >::Vector(), Vector< T >::Vector(), Vector< T >::Vector(), and Vector< T >::Vector().

## VectorBase() [2/2]

template<class T>

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

inline protected

Build a Vector with explicit values.

References getData(), mData, mEnd, mStart, and VECTORDEBUG.

## ~VectorBase()

template<class T>

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

inline

Destroy a Vector, deleting held memory.

References clear(), and VECTORDEBUG.

## Member Function Documentation

## begin() [1/2]

template<class T>

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

inline

## begin() [2/2]

template<class T>

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

inline

## bytes()

template<class T>

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

inline

Return size in bytes.

References size().

Referenced by clone(), and vConcat().

## clear()

template<class T>

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

inline

Release memory and clear pointers.

References resize().

Referenced by makeAlias(), shiftMem(), and ~VectorBase().

## clone()

template<class T>

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

inline

Copy data from another vector.

References bytes(), mData, mStart, resize(), size(), and VectorBase().

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

## copyTo()

template<class T>

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

inline

References copyToSegment(), size(), and VectorBase().

## 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 mEnd, mStart, and VectorBase().

Referenced by 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 copyToSegment(), size(), and VectorBase().

Referenced by copyToSegment().

## end() [1/2]

template<class T>

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

inline

## end() [2/2]

template<class T>

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

inline

Referenced by fill().

## fill() [1/2]

template<class T>

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

inline

References mEnd, and mStart.

## fill() [2/2]

template<class T>

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

inline

References end(), mEnd, and mStart.

## getData()

template<class T>

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

inline

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

## inspect()

template<class T>

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

inline

References mData, mEnd, and mStart.

## isOwner()

template<class T>

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

inline

## makeAlias()

template<class T>

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

inline protected

References clear(), getData(), mEnd, mStart, and VectorBase().

Referenced by operator=().

## operator=()

template<class T>

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

inline

Assign from another Vector.

References clone(), getData(), makeAlias(), and VectorBase().

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

template<class T>

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

inline

References mEnd, and mStart.

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

template<class T>

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

inline

References mEnd, and 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 mData, VECTORDEBUG, and vInit().

Referenced by clear(), clone(), 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 mEnd, mStart, and VectorBase().

## shiftMem()

template<class T>

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

inline protected

Assign from another Vector, shifting ownership.

References clear(), mData, mEnd, mStart, VectorBase(), 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 mData, mEnd, and mStart.

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

## vConcat()

template<class T>

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

inline

References bytes(), mStart, resize(), size(), and VectorBase().

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

## vInit()

template<class T>

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

inline protected

References mData, mEnd, and mStart.

Referenced by resize().

## Member Data Documentation

## mData

template<class T>

VectorDataType VectorBase< T >::mData

protected

allocated data block.

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

## mEnd

template<class T>

T* VectorBase< T >::mEnd

protected

end of useful data + 1

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

## mStart

template<class T>

T* VectorBase< T >::mStart

protected

start of useful data

Referenced by clone(), copyToSegment(), BitVector::dup(), BitVector::dup(), fill(), fill(), inspect(), makeAlias(), operator[](), operator[](), segmentCopyTo(), shiftMem(), size(), vConcat(), Vector< T >::Vector(), VectorBase(), VectorBase(), and vInit().

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

- Vector.h