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.

List of all members.

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 47 of file v_array.h.

~v_array (  ) 

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:
length 

Definition at line 209 of file v_array.h.

void decr (  ) 

Decrement the 'end' pointer.

Definition at line 98 of file v_array.h.

void decr (  ) 

Decrement the pointer to the last element

Definition at line 32 of file JLCoverTreePoint.h.

bool empty (  ) 

Check if array is empty or not.

Returns:
whether array is empty

Definition at line 92 of file v_array.h.

void erase (  ) 

Empty the array.

Definition at line 111 of file v_array.h.

unsigned int index (  ) 

Get number of elements in array.

Returns:
number of array elements

Definition at line 105 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 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.

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

Pop an array from a list of arrays.

Parameters:
stack array of arrays
Returns:
popped array

Definition at line 217 of file v_array.h.

T pop (  ) 

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

T* begin

Pointer to first element of the array.

Definition at line 155 of file v_array.h.

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 158 of file v_array.h.

Pointer to end of array, based on memory reserved.

Definition at line 161 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:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

SHOGUN Machine Learning Toolbox - Documentation