Richard Boegli's CnC_Generals_Zero_Hour Fork WIP
This is documentation of Richard Boegil's Zero Hour Fork
 
Loading...
Searching...
No Matches
SimpleDynVecClass< T > Class Template Reference

#include <simplevec.h>

Inherits SimpleVecClass< T >.

Public Member Functions

 SimpleDynVecClass (int size=0)
 
virtual ~SimpleDynVecClass (void)
 
int Count (void) const
 
T & operator[] (int index)
 
T const & operator[] (int index) const
 
virtual bool Resize (int newsize)
 
bool Add (T const &object, int new_size_hint=0)
 
T * Add_Multiple (int number_to_add)
 
bool Delete (int index, bool allow_shrink=true)
 
bool Delete (T const &object, bool allow_shrink=true)
 
bool Delete_Range (int start, int count, bool allow_shrink=true)
 
void Delete_All (bool allow_shrink=true)
 
- Public Member Functions inherited from SimpleVecClass< T >
 SimpleVecClass (int size=0)
 
virtual ~SimpleVecClass (void)
 
T & operator[] (int index)
 
T const & operator[] (int index) const
 
int Length (void) const
 
virtual bool Uninitialised_Grow (int newsize)
 
void Zero_Memory (void)
 

Protected Member Functions

bool Grow (int new_size_hint)
 
bool Shrink (void)
 
int Find_Index (T const &object)
 

Protected Attributes

int ActiveCount
 
- Protected Attributes inherited from SimpleVecClass< T >
T * Vector
 
int VectorMax
 

Detailed Description

template<class T>
class SimpleDynVecClass< T >

SimpleDynVecClass This is also a template designed to work with simple data types. It is designed to work just like DynamicVectorClass except that it assumes that the data type used can be legally mem-copied. DON'T USE THIS TEMPLATE IF YOUR CLASS REQUIRES A DESTRUCTOR!!!

The automatic resizing behavior for this class is a little different than DynamicVectorClass. When the vector needs to be resized, it grows by 25% and if it ever shrinks to 75% usage, it resizes downwards. In addition, when adding objects, you can pass in a "next-size-hint" which is the minimum size the vector will need to be once you are done adding your set of objects. This will cause it to resize to at least that size if it needs to resize. Just leave the parameter at its default value for default behavior.

Definition at line 255 of file simplevec.h.

Constructor & Destructor Documentation

◆ SimpleDynVecClass()

template<class T>
SimpleDynVecClass< T >::SimpleDynVecClass ( int size = 0)
inline

Definition at line 307 of file simplevec.h.

◆ ~SimpleDynVecClass()

template<class T>
SimpleDynVecClass< T >::~SimpleDynVecClass ( void )
inlinevirtual

Definition at line 326 of file simplevec.h.

Member Function Documentation

◆ Add()

template<class T>
bool SimpleDynVecClass< T >::Add ( T const & object,
int new_size_hint = 0 )
inline

Definition at line 371 of file simplevec.h.

◆ Add_Multiple()

template<class T>
T * SimpleDynVecClass< T >::Add_Multiple ( int number_to_add)
inline

Definition at line 404 of file simplevec.h.

◆ Count()

template<class T>
int SimpleDynVecClass< T >::Count ( void ) const
inline

Definition at line 263 of file simplevec.h.

◆ Delete() [1/2]

template<class T>
bool SimpleDynVecClass< T >::Delete ( int index,
bool allow_shrink = true )
inline

Definition at line 438 of file simplevec.h.

◆ Delete() [2/2]

template<class T>
bool SimpleDynVecClass< T >::Delete ( T const & object,
bool allow_shrink = true )
inline

Definition at line 479 of file simplevec.h.

◆ Delete_All()

template<class T>
void SimpleDynVecClass< T >::Delete_All ( bool allow_shrink = true)
inline

Definition at line 547 of file simplevec.h.

◆ Delete_Range()

template<class T>
bool SimpleDynVecClass< T >::Delete_Range ( int start,
int count,
bool allow_shrink = true )
inline

Definition at line 506 of file simplevec.h.

◆ Find_Index()

template<class T>
int SimpleDynVecClass< T >::Find_Index ( T const & object)
inlineprotected

Definition at line 632 of file simplevec.h.

◆ Grow()

template<class T>
bool SimpleDynVecClass< T >::Grow ( int new_size_hint)
inlineprotected

Definition at line 574 of file simplevec.h.

◆ operator[]() [1/2]

template<class T>
T & SimpleDynVecClass< T >::operator[] ( int index)
inline

Definition at line 264 of file simplevec.h.

◆ operator[]() [2/2]

template<class T>
T const & SimpleDynVecClass< T >::operator[] ( int index) const
inline

Definition at line 265 of file simplevec.h.

◆ Resize()

template<class T>
bool SimpleDynVecClass< T >::Resize ( int newsize)
inlinevirtual

Reimplemented from SimpleVecClass< T >.

Definition at line 348 of file simplevec.h.

◆ Shrink()

template<class T>
bool SimpleDynVecClass< T >::Shrink ( void )
inlineprotected

Definition at line 601 of file simplevec.h.

Member Data Documentation

◆ ActiveCount

template<class T>
int SimpleDynVecClass< T >::ActiveCount
protected

Definition at line 289 of file simplevec.h.


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