SHOGUN  3.2.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
List of all members | Public Member Functions | Public Attributes
v_array< T > Class Template Reference

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.

Public Member Functions

last ()
void decr ()
 v_array ()
T & operator[] (unsigned int i)
 v_array ()
 ~v_array ()
T & operator[] (unsigned int i)
last ()
pop ()
bool empty ()
void decr ()
unsigned int index ()
void erase ()
void push (const T &new_elem)
void push_many (const T *new_elem, size_t num)
void reserve (size_t length)
void calloc_reserve (size_t length)
v_array< T > pop (v_array< v_array< T > > &stack)

Public Attributes

int index
int length
T * elements
T * begin
 Pointer to first element of the array.
T * end
 Pointer to last set element in the array.
T * end_array
 Pointer to end of array, based on memory reserved.

Constructor & Destructor Documentation

v_array ( )

Create an empty v_array

Definition at line 35 of file JLCoverTreePoint.h.

v_array ( )

Constructor. Sets begin and end pointers to NULL.

Definition at line 49 of file v_array.h.

~v_array ( )

Destructor

will only free the array not the ptrs it contains

Definition at line 60 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
length

Definition at line 211 of file v_array.h.

void decr ( )

Decrement the pointer to the last element

Definition at line 32 of file JLCoverTreePoint.h.

void decr ( )

Decrement the 'end' pointer.

Definition at line 100 of file v_array.h.

bool empty ( )

Check if array is empty or not.

Returns
whether array is empty

Definition at line 94 of file v_array.h.

void erase ( )

Empty the array.

Definition at line 113 of file v_array.h.

unsigned int index ( )

Get number of elements in array.

Returns
number of array elements

Definition at line 107 of file v_array.h.

T last ( )

Getter for the the last element of the v_array

Returns
the last element of the array

Definition at line 29 of file JLCoverTreePoint.h.

T last ( )

Return the last element.

Returns
Last element of array

Definition at line 80 of file v_array.h.

T& operator[] ( unsigned int  i)

Element access operator

Parameters
iof the element to be read
Returns
the corresponding element

Definition at line 40 of file JLCoverTreePoint.h.

T& operator[] ( unsigned int  i)

Operator [] overloaded to return the i-th element of the stored array.

Parameters
iindex of the element, starting at 0
Returns
element at position i

Definition at line 73 of file v_array.h.

T pop ( )

Pop from the array.

Returns
Popped element

Definition at line 87 of file v_array.h.

v_array< T > pop ( v_array< v_array< T > > &  stack)

Pop an array from a list of arrays.

Parameters
stackarray of arrays
Returns
popped array

Definition at line 219 of file v_array.h.

void push ( const T &  new_elem)

Push an element into the array.

Parameters
new_elemelement to be pushed

Definition at line 168 of file v_array.h.

void push_many ( const T *  new_elem,
size_t  num 
)

Push multiple elements into the array.

Parameters
new_elempointer to first element
numnumber of elements

Definition at line 183 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
lengthnumber of elements to accommodate

Definition at line 199 of file v_array.h.

Member Data Documentation

T* begin

Pointer to first element of the array.

Definition at line 157 of file v_array.h.

T* elements

Pointer to the beginning of the v_array elements

Definition at line 50 of file JLCoverTreePoint.h.

T* end

Pointer to last set element in the array.

Definition at line 160 of file v_array.h.

T* end_array

Pointer to end of array, based on memory reserved.

Definition at line 163 of file v_array.h.

int index

Pointer to the last element of the v_array

Definition at line 44 of file JLCoverTreePoint.h.

int length

Length of the v_array

Definition at line 47 of file JLCoverTreePoint.h.


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

SHOGUN Machine Learning Toolbox - Documentation