Main Page   Modules   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages   Examples  

CTBvector Class Template Reference

Indexable vector container. **. More...

#include "CTBvector.hxx"

Inheritance diagram for CTBvector:

Inheritance graph
[legend]
Collaboration diagram for CTBvector:

Collaboration graph
[legend]
List of all members.

Public Types

typedef T Elem_t
typedef CTBretObj< CTBvector<
T > > 
RetObj

Public Methods

 CTBvector ()
 CTBvector (CTBint i_size)
 CTBvector (CTBint i_size, const T &def)
 CTBvector (const CTBvector< T > &rhs)
 CTBvector (CTBvector< T > &rhs, bool b_grab)
 CTBvector (CTBvector< T >::RetObj &rhs)
virtual ~CTBvector ()
CTBint Size () const
CTBint Capacity () const
CTBvectorDsc< TReverse ()
CTBvectorCDsc< TReverse () const
TAt (CTBint i_ind)
const TAt (CTBint i_ind) const
void Resize (CTBint i_size)
void Resize (CTBint i_size, const T &def)
void Insert (CTBint i_ind, const T &rhs)
void Remove (CTBint i_ind, T &rhs)
void Delete (CTBint i_ind)
void InsertHead (const T &rhs)
bool RemoveHead (T &rhs)
void InsertTail (const T &rhs)
bool RemoveTail (T &rhs)
void EnsureCapacity (CTBint i_cap)
void IncreaseCapacity (CTBint i_cap)
void TrimCapacity ()
void Grab (CTBvector< T > &rhs)
const TData () const
CTBint Stride () const
void Dump (int i_indent=0, ostream &os=cout, const char *p_text=0) const
Toperator[] (CTBint i_ind)
const Toperator[] (CTBint i_ind) const
Toperator() (CTBint i_ind)
const Toperator() (CTBint i_ind) const
CTBvectorDsc< Toperator() (const CTBrange &ran)
CTBvectorCDsc< Toperator() (const CTBrange &ran) const
bool operator! () const
 operator T * ()
 operator const T * () const
 operator CTBvectorDsc ()
 operator CTBvectorCDsc () const
CTBvector< T > & operator= (const T &rhs)
CTBvector< T > & operator= (const CTBvector< T > &rhs)
CTBvector< T > & operator= (const CTBvectorCDsc< T > &rhs)
CTBvector< T > & operator= (CTBvector< T >::RetObj &rhs)
CTBvector< T > & operator<< (const T &rhs)
CTBvector< T > & operator>> (T &rhs)

Private Methods

void ChangeCapacity (CTBint i_cap)

Private Attributes

CTBrawBuffer< Tm_rbuf
CTBint mi_nuse

Related Functions

(Note that these are not member functions.)

ostream & operator<< (ostream &os, const CTBvector< T > &obj)

Detailed Description

template<class T>
class CTBvector< T >

Indexable vector container. **.

Requirements:
Implementation Notes:

Definition at line 23 of file CTBvector.hxx.


Member Typedef Documentation

template<class T>
typedef T CTBvector::Elem_t
 

vector element type.

Definition at line 27 of file CTBvector.hxx.

template<class T>
typedef CTBretObj<CTBvector<T> > CTBvector::RetObj
 

Definition at line 28 of file CTBvector.hxx.


Constructor & Destructor Documentation

template<class T>
CTBvector< T >::CTBvector [inline]
 

Construct empty (size=0) vector.

Definition at line 20 of file CTBvector.icc.

template<class T>
CTBvector< T >::CTBvector CTBint i_size [explicit]
 

Construct with size i_size.

Definition at line 55 of file CTBvector.cxx.

template<class T>
CTBvector< T >::CTBvector CTBint i_size,
const T & def
 

Construct with size i_size and default value def.

Definition at line 69 of file CTBvector.cxx.

template<class T>
CTBvector< T >::CTBvector const CTBvector< T > & rhs
 

Copy constructor.

Definition at line 83 of file CTBvector.cxx.

template<class T>
CTBvector< T >::CTBvector CTBvector< T > & rhs,
bool b_grab
[inline]
 

Grab constructor.

Definition at line 29 of file CTBvector.icc.

template<class T>
CTBvector< T >::CTBvector CTBvector< T >::RetObj & rhs [inline]
 

Construct from return object.

Definition at line 40 of file CTBvector.icc.

template<class T>
CTBvector< T >::~CTBvector [virtual]
 

Virtual destructor.

Definition at line 97 of file CTBvector.cxx.


Member Function Documentation

template<class T>
CTBint CTBvector< T >::Size const [inline]
 

Returns size of vector.

Definition at line 51 of file CTBvector.icc.

Referenced by CTBstack::At(), CTBadd(), CTBdot(), CTBsub(), ChangeCapacity(), CTBstack::Delete(), CTBprintfVV::Dimension1(), CTBprintfVM::Dimension1(), CTBprintfVV::Dimension2(), CTBattrList::Find(), CTBattrList::FindOrCreate(), CTBxmlIStream::GetTagFromLexer(), CTBstack::Insert(), CTBxmlToken::NAttribute(), CTBxmlOStream::PutEmptyTag(), CTBxmlOStream::PutEndTag(), CTBxmlOStream::PutStartTag(), CTBstack::Remove(), CTBattrList::Size(), CTBxmlToken::ToStream(), CTBattrList::ToStream(), CTBattrList::ToXStream(), TrimCapacity(), operator *=(), CTBattrList::operator void *(), CTBattrList::operator!(), CTBsortS::operator()(), CTBsortQ::operator()(), CTBsortI::operator()(), operator+=(), operator-=(), operator/=(), operator=(), CTBstack::operator[](), and CTBattrList::operator[]().

template<class T>
CTBint CTBvector< T >::Capacity const [inline]
 

Returns capacity of vector.

Definition at line 60 of file CTBvector.icc.

Referenced by EnsureCapacity(), IncreaseCapacity(), Insert(), InsertTail(), Resize(), and TrimCapacity().

template<class T>
CTBvectorDsc< T > CTBvector< T >::Reverse [inline]
 

Returns vector descriptor for vector with reversed indexing.

Definition at line 69 of file CTBvector.icc.

template<class T>
CTBvectorCDsc< T > CTBvector< T >::Reverse const [inline]
 

Returns constant vector descriptor for vector with reversed indexing.

Definition at line 78 of file CTBvector.icc.

template<class T>
T & CTBvector< T >::At CTBint i_ind
 

Access vector element with index range check.

Exceptions:
CTBexceptionIndexRange   index out of range

Reimplemented in CTBstack.

Definition at line 112 of file CTBvector.cxx.

Referenced by CTBstack::At(), operator()(), and operator[]().

template<class T>
const T & CTBvector< T >::At CTBint i_ind const
 

Constant access vector element with index range check.

Exceptions:
CTBexceptionIndexRange   index out of range

Reimplemented in CTBstack.

Definition at line 127 of file CTBvector.cxx.

template<class T>
void CTBvector< T >::Resize CTBint i_size
 

Change size of vector to i_size.

Reimplemented in CTBstack.

Definition at line 139 of file CTBvector.cxx.

Referenced by CTBadd(), CTBdot(), CTBsub(), CTBxmlToken::Clear(), CTBattrList::Clear(), CTBxmlIStream::GetTagFromLexer(), CTBstack::Resize(), CTBsortS::operator()(), CTBsortQ::operator()(), CTBsortI::operator()(), CTBcallbackSource1R::operator()(), and CTBcallbackSource0R::operator()().

template<class T>
void CTBvector< T >::Resize CTBint i_size,
const T & def
 

Change size of vector to i_size, set new elements to def.

Reimplemented in CTBstack.

Definition at line 159 of file CTBvector.cxx.

template<class T>
void CTBvector< T >::Insert CTBint i_ind,
const T & rhs
 

Insert a new element.

Reimplemented in CTBstack.

Definition at line 179 of file CTBvector.cxx.

Referenced by CTBstack::Insert(), and InsertHead().

template<class T>
void CTBvector< T >::Remove CTBint i_ind,
T & rhs
[inline]
 

Remove element.

Reimplemented in CTBstack.

Definition at line 87 of file CTBvector.icc.

Referenced by CTBstack::Remove(), and RemoveHead().

template<class T>
void CTBvector< T >::Delete CTBint i_ind
 

Delete element.

Reimplemented in CTBstack.

Definition at line 204 of file CTBvector.cxx.

Referenced by CTBstack::Delete(), and Remove().

template<class T>
void CTBvector< T >::InsertHead const T & rhs [inline]
 

Insert at begin of vector.

Reimplemented in CTBstack.

Definition at line 98 of file CTBvector.icc.

Referenced by CTBstack::InsertTail().

template<class T>
bool CTBvector< T >::RemoveHead T & rhs [inline]
 

Remove from begin of vector, returns true on success.

If the vector is not empty, the element at the begin of the vector is copied to rhs and true is returned. If the vector is empty, rhs is unchanged and false is returned.

Reimplemented in CTBstack.

Definition at line 113 of file CTBvector.icc.

Referenced by CTBstack::RemoveTail().

template<class T>
void CTBvector< T >::InsertTail const T & rhs [inline]
 

Insert at end of vector.

Reimplemented in CTBstack.

Definition at line 124 of file CTBvector.icc.

Referenced by CTBstack::InsertHead(), and operator<<().

template<class T>
bool CTBvector< T >::RemoveTail T & rhs [inline]
 

Remove from end of vector, returns true on success.

If the vector is not empty, the element at the end of the vector is copied to rhs and true is returned. If the vector is empty, rhs is unchanged and false is returned.

Reimplemented in CTBstack.

Definition at line 146 of file CTBvector.icc.

Referenced by CTBstack::RemoveHead(), and operator>>().

template<class T>
void CTBvector< T >::EnsureCapacity CTBint i_cap [inline]
 

Ensure capacity of at least i_cap elements.

Definition at line 163 of file CTBvector.icc.

Referenced by CTBstack::CTBstack(), CTBcallbackSource1R::operator()(), CTBcallbackSource0R::operator()(), and operator=().

template<class T>
void CTBvector< T >::IncreaseCapacity CTBint i_cap
 

Increase capacity to i_cap, at least double it.

Definition at line 221 of file CTBvector.cxx.

Referenced by Insert(), and InsertTail().

template<class T>
void CTBvector< T >::TrimCapacity [inline]
 

Reduce capacity to size.

Definition at line 173 of file CTBvector.icc.

template<class T>
void CTBvector< T >::Grab CTBvector< T > & rhs
 

Grab resources.

The resources allocated for rhs will be transfered to the calling object.

Definition at line 234 of file CTBvector.cxx.

Referenced by CTBxmlToken::Grab(), CTBstack::Grab(), and operator=().

template<class T>
const T * CTBvector< T >::Data const [inline]
 

Returns pointer to first element of vector.

This method is equivalent to operator T *() and has only been added to provide the interface used by CTBvectorDsc also for CTBvector.

Definition at line 187 of file CTBvector.icc.

template<class T>
CTBint CTBvector< T >::Stride const [inline]
 

Returns stride of vector (returns always 1).

This method returns always 1 and has only been added to provide the interface used by CTBvectorDsc also for CTBvector.

Definition at line 200 of file CTBvector.icc.

template<class T>
void CTBvector< T >::Dump int i_indent = 0,
ostream & os = cout,
const char * p_text = 0
const
 

Dump.

Definition at line 249 of file CTBvector.cxx.

Referenced by CTBxmlOStream::Dump(), CTBxmlIStream::Dump(), and CTBxmlToken::Dump().

template<class T>
T & CTBvector< T >::operator[] CTBint i_ind [inline]
 

Access element (index checked ifdef CTB__IndexCheck).

Reimplemented in CTBstack.

Definition at line 209 of file CTBvector.icc.

Referenced by CTBstack::operator[]().

template<class T>
const T & CTBvector< T >::operator[] CTBint i_ind const [inline]
 

Constant access element (index checked ifdef CTB__IndexCheck).

Reimplemented in CTBstack.

Definition at line 222 of file CTBvector.icc.

template<class T>
T & CTBvector< T >::operator() CTBint i_ind [inline]
 

Access element (index checked ifdef CTB__IndexCheck).

Definition at line 235 of file CTBvector.icc.

template<class T>
const T & CTBvector< T >::operator() CTBint i_ind const [inline]
 

Constant access element (index checked ifdef CTB__IndexCheck).

Definition at line 248 of file CTBvector.icc.

template<class T>
CTBvectorDsc< T > CTBvector< T >::operator() const CTBrange & ran [inline]
 

Acess vector subrange (index checked ifdef CTB__IndexCheck).

Definition at line 261 of file CTBvector.icc.

template<class T>
CTBvectorCDsc< T > CTBvector< T >::operator() const CTBrange & ran const [inline]
 

Constant acess vector subrange (index checked ifdef CTB__IndexCheck).

Definition at line 273 of file CTBvector.icc.

template<class T>
bool CTBvector< T >::operator! const [inline]
 

Returns true if vector empty (equivalent to Size() == 0).

Definition at line 285 of file CTBvector.icc.

template<class T>
CTBvector< T >::operator T * [inline]
 

Convert to pointer to data, returns null if Size()==0.

Definition at line 294 of file CTBvector.icc.

template<class T>
CTBvector< T >::operator const T * const [inline]
 

Constant convert to pointer to data, returns null if Size()==0.

Definition at line 303 of file CTBvector.icc.

template<class T>
CTBvector< T >::operator CTBvectorDsc< T > [inline]
 

Convert to vector descriptor.

Definition at line 312 of file CTBvector.icc.

template<class T>
CTBvector< T >::operator CTBvectorCDsc< T > const [inline]
 

Convert to constant vector descriptor.

Definition at line 321 of file CTBvector.icc.

template<class T>
CTBvector< T > & CTBvector< T >::operator= const T & rhs
 

Set all elements to the scalar value rhs.

Reimplemented in CTBstack.

Definition at line 265 of file CTBvector.cxx.

template<class T>
CTBvector< T > & CTBvector< T >::operator= const CTBvector< T > & rhs
 

Copy elements of vector rhs.

Implementation Notes:
  • An explicit assignment operator is needed to implement the desired `deep copy' semantics. The default compiler generated assignment operator would implement `shallow copy' semantics.

Definition at line 285 of file CTBvector.cxx.

template<class T>
CTBvector< T > & CTBvector< T >::operator= const CTBvectorCDsc< T > & rhs
 

Copy elements of vector descriptor rhs.

Definition at line 304 of file CTBvector.cxx.

template<class T>
CTBvector< T > & CTBvector< T >::operator= CTBvector< T >::RetObj & rhs [inline]
 

Assign from return object.

Definition at line 330 of file CTBvector.icc.

template<class T>
CTBvector< T > & CTBvector< T >::operator<< const T & rhs [inline]
 

Insert a new element with value rhs at tail of vector.

Reimplemented in CTBstack.

Definition at line 340 of file CTBvector.icc.

template<class T>
CTBvector< T > & CTBvector< T >::operator>> T & rhs [inline]
 

Return last element of vector as rhs, remove last element.

Reimplemented in CTBstack.

Definition at line 350 of file CTBvector.icc.

template<class T>
void CTBvector< T >::ChangeCapacity CTBint i_cap [private]
 

Change capacity.

Definition at line 329 of file CTBvector.cxx.

Referenced by EnsureCapacity(), IncreaseCapacity(), Resize(), and TrimCapacity().


Friends And Related Function Documentation

template<class T>
ostream & operator<< ostream & os,
const CTBvector< T > & obj
[related]
 

ostream insertion.

Definition at line 363 of file CTBvector.icc.


Member Data Documentation

template<class T>
CTBrawBuffer<T> CTBvector::m_rbuf [private]
 

raw memory buffer.

Definition at line 105 of file CTBvector.hxx.

template<class T>
CTBint CTBvector::mi_nuse [private]
 

number of constructed elements.

Definition at line 106 of file CTBvector.hxx.


The documentation for this class was generated from the following files:
Generated at Fri Oct 24 18:14:13 2003 for CTBbase by doxygen1.2.9-20010812 written by Dimitri van Heesch, © 1997-2001