A scalar vector handles data types without constructor or destructor, that may be copied using a binary copy. This "base" class is untyped; all what is known here about the vector elements are their size. Therefore, any auxiliary storage needs dynamicaly allocated memory. In order not to fraction the memory and not to call allocation more than necessary, the vector data buffer includes two extra rooms: one for temporary storage, the other one to store a default value. Moreover, allocation is done by increments configured by TSVECTOR_INCREMENT constant. Therefore, the buffer bounds may differ from the user bounds. User bounds will correspond to interval [start;finish[ (finish excluded), although available bounds will be [_start+2;_finish[, as two extra rooms are allocated. The reallocation and reservation method will be as follows:
_svector | ( | ) | [inline] |
Empty vector constructor.
No allocation performed at all for efficiency (transient state)
_svector | ( | int | a, | |
int | b, | |||
int | size_elt, | |||
const void * | p = 0 | |||
) | [inline] |
Constructs vector [a:b] of elements of size size_elt init to *p.
~_svector | ( | ) | [inline] |
int InBuffRange | ( | int | index | ) | const [inline, protected] |
Checks if index may be valid for buff without reallocation.
void* tmpptr | ( | ) | [inline, protected] |
Pointer to temporary element at index _start+1.
const void* tmpptr | ( | ) | const [inline, protected] |
void* ptr | ( | int | i | ) | [inline, protected] |
Returns pointer to user element at index i.
const void* ptr | ( | int | i | ) | const [inline, protected] |
void ReserveGrow | ( | int | a, | |
int | b | |||
) | [inline, protected] |
Makes sure vector can be indexed in range [a:b].
If a resize has to be performed, the size increment will be at least equal to TSVECTOR_INCREMENT. If the vector may handle negative user indices (start<0) or growth is requested both sides, growth is performed in a symetric way.
void realloc_buffer | ( | ) | [inline, protected] |
Reallocates buffer to hold (_finish-_start) elements.
void reserve | ( | int | a, | |
int | b | |||
) | [inline] |
Reserves rooms to handle [a;b].
This methods concerns the case where the extremal user bounds are known in advance. In such a case, we want a tight allocation (no need to reserve more that what we know to be possibly used).
void vreserve | ( | int | s, | |
int | f, | |||
T_STD size_t | nsize_elmt | |||
) | [inline, protected] |
Makes buffer [s:f] with elements of size nsize_elmt.
This method will be used to "reformat" a vector during a copy operation. Two cases may occur: if the new element size is equal to the old element size, we assume that the default value (when set) will still be valid. It is hence copied, should a reallocation occur. Otherwise, default value is unset.
copy helper (for copy constructor and assignment)
int empty | ( | ) | const [inline] |
Tests whether vector is empty (no elements).
int InRange | ( | int | index | ) | const [inline] |
Checks whether user index is valid for vector.
int getsize | ( | ) | const [inline] |
Returns size of vector in bytes.
int n | ( | ) | const [inline] |
Returns length of vector in number of elements.
int SizeElmt | ( | ) | const [inline] |
Returns size of a single element in bytes.
int starti | ( | ) | const [inline] |
Returns first index of vector.
int stopi | ( | ) | const [inline] |
Returns 1 past-end index of vector.
void* begin | ( | ) | [inline] |
Returns pointer to first element of vector.
Reimplemented in svector, svector< long >, svector< double >, svector< vProp1 * >, svector< Taxi_FileIO * >, svector< tbrin >, svector< ColorItem * >, svector< Point3_ >, svector< int >, svector< _svector * >, svector< Taxi_rgb >, svector< short >, svector< ThickItem * >, svector< void * >, svector< char >, svector< vProp * >, svector< bool >, svector< svector< double > * >, svector< tvertex >, svector< tedge >, svector< Point2_ >, and svector< char * >.
const void* begin | ( | ) | const [inline] |
Reimplemented in svector, svector< long >, svector< double >, svector< vProp1 * >, svector< Taxi_FileIO * >, svector< tbrin >, svector< ColorItem * >, svector< Point3_ >, svector< int >, svector< _svector * >, svector< Taxi_rgb >, svector< short >, svector< ThickItem * >, svector< void * >, svector< char >, svector< vProp * >, svector< bool >, svector< svector< double > * >, svector< tvertex >, svector< tedge >, svector< Point2_ >, and svector< char * >.
void* origin | ( | ) | [inline] |
Returns pointer to element at index 0.
Reimplemented in svector, svector< long >, svector< double >, svector< vProp1 * >, svector< Taxi_FileIO * >, svector< tbrin >, svector< ColorItem * >, svector< Point3_ >, svector< int >, svector< _svector * >, svector< Taxi_rgb >, svector< short >, svector< ThickItem * >, svector< void * >, svector< char >, svector< vProp * >, svector< bool >, svector< svector< double > * >, svector< tvertex >, svector< tedge >, svector< Point2_ >, and svector< char * >.
const void* origin | ( | ) | const [inline] |
Reimplemented in svector, svector< long >, svector< double >, svector< vProp1 * >, svector< Taxi_FileIO * >, svector< tbrin >, svector< ColorItem * >, svector< Point3_ >, svector< int >, svector< _svector * >, svector< Taxi_rgb >, svector< short >, svector< ThickItem * >, svector< void * >, svector< char >, svector< vProp * >, svector< bool >, svector< svector< double > * >, svector< tvertex >, svector< tedge >, svector< Point2_ >, and svector< char * >.
void* end | ( | ) | [inline] |
Returns pointer to 1 past-end element.
Reimplemented in svector, svector< long >, svector< double >, svector< vProp1 * >, svector< Taxi_FileIO * >, svector< tbrin >, svector< ColorItem * >, svector< Point3_ >, svector< int >, svector< _svector * >, svector< Taxi_rgb >, svector< short >, svector< ThickItem * >, svector< void * >, svector< char >, svector< vProp * >, svector< bool >, svector< svector< double > * >, svector< tvertex >, svector< tedge >, svector< Point2_ >, and svector< char * >.
const void* end | ( | ) | const [inline] |
Reimplemented in svector, svector< long >, svector< double >, svector< vProp1 * >, svector< Taxi_FileIO * >, svector< tbrin >, svector< ColorItem * >, svector< Point3_ >, svector< int >, svector< _svector * >, svector< Taxi_rgb >, svector< short >, svector< ThickItem * >, svector< void * >, svector< char >, svector< vProp * >, svector< bool >, svector< svector< double > * >, svector< tvertex >, svector< tedge >, svector< Point2_ >, and svector< char * >.
void resize | ( | int | a, | |
int | b | |||
) | [inline] |
Resize vector to index range [a:b].
void clear | ( | ) | [inline] |
Clears all elements to 0.
void fill | ( | int | from, | |
int | to, | |||
char | byte = 0 | |||
) | [inline] |
Fill vector [from:to] with byte values.
void reset | ( | int | a, | |
int | b | |||
) | [inline] |
Sets vector [a:b] to initial value (if defined).
void reset | ( | ) | [inline] |
Sets all vector elements to initial value (if defined).
void Tswap | ( | _svector & | s | ) | [inline] |
Swaps vectors.
const void* pinit | ( | ) | const [inline] |
Returns pointer to initial value.
Reimplemented in svector, svector< long >, svector< double >, svector< vProp1 * >, svector< Taxi_FileIO * >, svector< tbrin >, svector< ColorItem * >, svector< Point3_ >, svector< int >, svector< _svector * >, svector< Taxi_rgb >, svector< short >, svector< ThickItem * >, svector< void * >, svector< char >, svector< vProp * >, svector< bool >, svector< svector< double > * >, svector< tvertex >, svector< tedge >, svector< Point2_ >, and svector< char * >.
void* pinit | ( | ) | [inline] |
void definit | ( | const void * | p | ) | [inline] |
Defines p to be the initial value. When 0, clears it.
void SetName | ( | const char * | txt | ) | [inline] |
const char* GetName | ( | ) | const [inline] |
void check | ( | int | ) | const [inline] |
void SwapIndex | ( | int | a, | |
int | b | |||
) | [inline] |
Swaps elements indexed by a and b.
Reimplemented in svector, svector< long >, svector< double >, svector< vProp1 * >, svector< Taxi_FileIO * >, svector< tbrin >, svector< ColorItem * >, svector< Point3_ >, svector< int >, svector< _svector * >, svector< Taxi_rgb >, svector< short >, svector< ThickItem * >, svector< void * >, svector< char >, svector< vProp * >, svector< bool >, svector< svector< double > * >, svector< tvertex >, svector< tedge >, svector< Point2_ >, and svector< char * >.
void CopyIndex | ( | int | a, | |
int | b | |||
) | [inline] |
Copies element b to a.
void qsort | ( | int(*)(const void *, const void *) | compare | ) | [inline] |
bool operator== | ( | const _svector & | v | ) | const [inline] |
bool operator!= | ( | const _svector & | v | ) | const [inline] |
void Destroy | ( | _svector & | x | ) | [friend] |
int start [protected] |
int finish [protected] |
void* ptr0 [protected] |
void* buff [protected] |
int _start [protected] |
int _finish [protected] |
T_STD size_t size_elmt [protected] |
void* init [protected] |
char name[16] [protected] |