Gk-arrays
Efficient read indexing
 All Classes Functions
Public Member Functions
gkarrays::SolArray Class Reference

#include <solArray.h>

List of all members.

Public Member Functions

 SolArray ()
 SolArray (uintSA nbElements, array_type t)
 SolArray (void *ptr, array_type t, uintSA nbElements) throw (invalid_argument)
 SolArray (SolArray &sa)
void init (uintSA nbElements, array_type t)
uintSA get (uintSA pos)
array_type getType ()
uintSA length ()
void realloc (uintSA nbElements) throw (logic_error)
void set (uintSA pos, uintSA value)
uintSA operator[] (uintSA pos)

Detailed Description

Small Or Large (SOL) Array storing integers. A SOL array can either store 32-bit, 64-bit integers, or fixed length integers on a different number of bits, depending on the user choice. This class allows to deal with the same variable whatever the type of integers we are storing.


Constructor & Destructor Documentation

Default constructor

Postcondition:
getType() == SMALL_ARRAY && length() == 0
gkarrays::SolArray::SolArray ( uintSA  nbElements,
array_type  t 
)
Parameters:
nbElements,:number of elements to be stored in the array.
t,:type of the array to be constructed. This specifies if we need to build a small array (32-bit integers) a large array (64-bit integers) or an optimal array which uses the optimal number of bits in memory (but which is longer)
gkarrays::SolArray::SolArray ( void *  ptr,
array_type  t,
uintSA  nbElements 
) throw (invalid_argument)
Parameters:
ptr,:pointer to an already allocated memory
t,:type of the array to be built
nbElements,:Number of elements that can be stored in the array
Precondition:
t == SMALL_ARRAY || t == LARGE_ARRAY (doestn't work for bit vectors -- yet?)

Copy constructor. Warning, the arrays are not copied, only the pointers are (to avoid huge memory consumption).


Member Function Documentation

uintSA gkarrays::SolArray::get ( uintSA  pos) [inline]
Parameters:
pos,:position in the array
Precondition:
pos >= 0 && pos < length()
Returns:
the value in the array at position pos
array_type gkarrays::SolArray::getType ( ) [inline]
Returns:
the type of the SolArray that was constructed .
void gkarrays::SolArray::init ( uintSA  nbElements,
array_type  t 
)
Parameters:
nbElements,:number of elements to be stored in the array.
t,:type of the array to be constructed
Precondition:
The previous arrays must have been deleted if needed.
Postcondition:
length() == nbElements && getType() == t
uintSA gkarrays::SolArray::length ( ) [inline]
Returns:
The number of elements we can store in the array.
uintSA gkarrays::SolArray::operator[] ( uintSA  pos) [inline]

A shortcut to the get method.

void gkarrays::SolArray::realloc ( uintSA  nbElements) throw (logic_error)
Parameters:
nbElements,:number of elements the array must be reallocated to
Precondition:
getType() != OPTIMAL_ARRAY
Postcondition:
length() == nbElements AND the memory has been reallocated.
void gkarrays::SolArray::set ( uintSA  pos,
uintSA  value 
) [inline]
Parameters:
pos,:position in the array
value,:value to be stored.
Precondition:
pos >= 0 && pos < length()
Postcondition:
get(pos) == value

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