WoMax Documentation OMax Logo

O_data Class Reference
[Data Sequence structure]

Data sequence class. More...

#include <Oracle_data.hpp>

Collaboration diagram for O_data:
Collaboration graph
[legend]

List of all members.

Protected Attributes

int size
 Current size of the sequence.
vector< O_label * > state_vect
 Vector of references to all the states of the sequence.
Hash tables



map< int, int > * dates2states
 Hash table to convert dates (ms) to state numbers.
map< int, int > * states2dates
 Hash table to convert state numbers to dates (ms).

Public Member Functions

Constructors & Destructors



 O_data ()
 Default constructor.
 O_data (const O_data &)
 Copy constructor.
 ~O_data ()
 Standard destructor.
Initialisation & Reset



template<class O_DataType >
void start ()
 Initialisation.
template<class O_DataType >
void freestates ()
 Reset with erasing of all data.
void clear_vect ()
 Reset sequence without deletion of states.
Add & Size



template<class O_DataType >
int add (int, O_label *)
 Add state to the sequence.
int get_size ()
 Return the current size of the sequence.
Dates to States functions



void add_date (O_label &)
 Reference a date from data.
void add_date (int, int)
 Reference a date with a state number.
int get_state (int)
 Find a state from a date.
void reset_D2S ()
 Reset hash table.
States to Dates functions



void add_state (O_label &)
 Reference a state from data.
void add_state (int, int)
 Reference a state from its date and number.
int get_date (int)
 Find the date of a state.
void reset_S2D ()
 Reset hash table.
Operators Overload



O_labeloperator[] (int) const
 Access states of the sequence.

Friends

class O_learner

Detailed Description

Data sequence class.

This class implements the structure holding a sequence of states containing data. To be able to use this class for different types of data, some of its members are template methodes. States are stored with their numbers as index in a vector. However as musical data is timed, it is useful to efficiently access data states with their dates. Thus this class also implements hash tables to switch between state numbers and dates.

Definition at line 26 of file Oracle_data.hpp.


Constructor & Destructor Documentation

O_data::O_data (  ) 

Default constructor.

Remarks:
Size is initialised to -1 and hash tables references (states2dates and dates2states) to NULL

Definition at line 112 of file Oracle_data.hpp.

O_data::~O_data (  ) 

Standard destructor.

Remarks:
Deletes and frees memory of hash tables.

Definition at line 127 of file Oracle_data.hpp.


Member Function Documentation

template<class O_DataType >
int O_data::add ( int  date,
O_label labelin 
) [inline]

Add state to the sequence.

State pointed by labelin is pushed in the sequence and referenced in hash tables at the given date

Remarks:
Initialises the data structure if needed
Returns:
The number of the state just added (= size of the data stucture - 1)

Definition at line 178 of file Oracle_data.hpp.

Here is the call graph for this function:

void O_data::add_date ( int  datein,
int  statenb 
)

Reference a date with a state number.

Parameters:
datein date to reference
statenb number of the state to reference

Definition at line 203 of file Oracle_data.hpp.

void O_data::add_state ( int  statenb,
int  datein 
)

Reference a state from its date and number.

Parameters:
statenb number of the state to reference
datein date of the state

Definition at line 232 of file Oracle_data.hpp.

void O_data::clear_vect (  ) 

Reset sequence without deletion of states.

Clear the vector of references and resets size without erasing data

Definition at line 170 of file Oracle_data.hpp.

template<class O_DataType >
void O_data::freestates (  )  [inline]

Reset with erasing of all data.

Delete and free the memory for every states of the sequence and resets size

Definition at line 136 of file Oracle_data.hpp.

int O_data::get_date ( int  statenb  ) 

Find the date of a state.

Returns:
The date of the given state

Definition at line 237 of file Oracle_data.hpp.

int O_data::get_state ( int  date  ) 

Find a state from a date.

Retreive the first state finishing at or after the given date

Returns:
The state number

Definition at line 209 of file Oracle_data.hpp.

template<class O_DataType >
void O_data::start (  )  [inline]

Initialisation.

Create the first state (numbered 0), sets size to 1, instantiates hash tables and adds state 0 corresponding to date 0

Definition at line 155 of file Oracle_data.hpp.


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

Generated on 16 Mar 2010 for Benjamin Lévy by  doxygen 1.6.1