Detailed Description
template<class T>
class shogun::v_array< T >
Class v_array taken directly from JL's implementation.
Class v_array is a templated class used to store variable length arrays. Memory locations are stored as 'extents', i.e., address of the first memory location and address after the last member.
`begin', `end' and `end_array' handle the extent of the array. `end_array' is the address at the end of the space allocated for the array while `end' is the address at the end of the space actually filled with elements.
The class should be instantiated on the basis of the data type of the contained array, eg. v_array<float32_t> if one wants to store a float32_t* array.
Definition at line 24 of file JLCoverTreePoint.h.
List of all members.
Constructor & Destructor Documentation
Constructor. Sets begin and end pointers to NULL.
Definition at line 47 of file v_array.h.
Destructor
will only free the array not the ptrs it contains
Definition at line 58 of file v_array.h.
Member Function Documentation
void calloc_reserve |
( |
size_t |
length |
) |
|
Reserve space for specified number of elements. No reallocation is done, array is replaced.
- Parameters:
-
Definition at line 209 of file v_array.h.
Decrement the 'end' pointer.
Definition at line 98 of file v_array.h.
Check if array is empty or not.
- Returns:
- whether array is empty
Definition at line 92 of file v_array.h.
Get number of elements in array.
- Returns:
- number of array elements
Definition at line 105 of file v_array.h.
Return the last element.
- Returns:
- Last element of array
Definition at line 78 of file v_array.h.
T& operator[] |
( |
unsigned int |
i |
) |
|
Operator [] overloaded to return the i-th element of the stored array.
- Parameters:
-
| i | index of the element, starting at 0 |
- Returns:
- element at position i
Definition at line 71 of file v_array.h.
T& operator[] |
( |
unsigned int |
i |
) |
|
Element access operator
- Parameters:
-
| i | of the element to be read |
- Returns:
- the corresponding element
Definition at line 40 of file JLCoverTreePoint.h.
Pop an array from a list of arrays.
- Parameters:
-
- Returns:
- popped array
Definition at line 217 of file v_array.h.
Pop from the array.
- Returns:
- Popped element
Definition at line 85 of file v_array.h.
void push |
( |
const T & |
new_elem |
) |
|
Push an element into the array.
- Parameters:
-
| new_elem | element to be pushed |
Definition at line 166 of file v_array.h.
void push_many |
( |
const T * |
new_elem, |
|
|
size_t |
num | |
|
) |
| | |
Push multiple elements into the array.
- Parameters:
-
| new_elem | pointer to first element |
| num | number of elements |
Definition at line 181 of file v_array.h.
void reserve |
( |
size_t |
length |
) |
|
Reserve space for specified number of elements. Reallocate, keeping the elements currently in the array.
- Parameters:
-
| length | number of elements to accommodate |
Definition at line 197 of file v_array.h.
Member Data Documentation
Pointer to first element of the array.
Definition at line 155 of file v_array.h.
Pointer to last set element in the array.
Definition at line 158 of file v_array.h.
Pointer to end of array, based on memory reserved.
Definition at line 161 of file v_array.h.
The documentation for this class was generated from the following files: