state.hh File Reference

Go to the source code of this file.

Classes

struct  state_t
 Structure representing the state of the system. More...

Functions

void byte_to_state_pos (const state_t state, const std::size_t pos, const byte_t value)
void clear_state (state_t)
 Fills a memory representing the state with zeros.
void delete_state (state_t &state)
 Deletes the state.
state_t duplicate_state (state_t state)
 Creates a copy of state `state' and returns a pointer to it.
void int_to_state_pos (const state_t state, const std::size_t pos, const sshort_int_t value)
state_t new_state (char *const state_memory, const std::size_t size)
 Creates a new state and returns a pointer to it.
state_t new_state (const std::size_t size)
 Creates a new state and returns a pointer to it.
bool operator!= (const state_t &arg1, const state_t &arg2)
 Returns whether state `arg1' is different from `arg2' using function memcmp().
bool operator< (const state_t &arg1, const state_t &arg2)
 Returns whether state `arg1' is smaller than `arg2' using function memcmp().
bool operator== (const state_t &arg1, const state_t &arg2)
 Returns whether state `arg1' is the same as `arg2' using function memcmp().
bool operator> (const state_t &arg1, const state_t &arg2)
 Returns whether state `arg1' is larger than `arg2' using function memcmp().
void realloc_state (state_t &state, size_t new_size)
 Realloc state. Exisiting data blosk is deleted, and replpaced with a new one of given size.
template<class T>
void set_to_state_pos (const state_t state, const std::size_t pos, const T value)
 Sets the value of type `T' to `state' at the position `pos'.
template<>
void set_to_state_pos< byte_t > (const state_t state, const std::size_t pos, const byte_t value)
template<>
void set_to_state_pos< sshort_int_t > (const state_t state, const std::size_t pos, const sshort_int_t value)
template<>
void set_to_state_pos< ulong_int_t > (const state_t state, const std::size_t pos, const ulong_int_t value)
template<>
void set_to_state_pos< ushort_int_t > (const state_t state, const std::size_t pos, const ushort_int_t value)
template<class T>
state_pos_to (const state_t state, const std::size_t pos)
 Returns the value of type `T' stored in `state' at the position `pos'.
template<>
byte_t state_pos_to< byte_t > (const state_t state, const std::size_t pos)
template<>
sshort_int_t state_pos_to< sshort_int_t > (const state_t state, const std::size_t pos)
template<>
ulong_int_t state_pos_to< ulong_int_t > (const state_t state, const std::size_t pos)
template<>
ushort_int_t state_pos_to< ushort_int_t > (const state_t state, const std::size_t pos)
byte_t state_pos_to_byte (const state_t state, const std::size_t pos)
sshort_int_t state_pos_to_int (const state_t state, const std::size_t pos)
ushort_int_t state_pos_to_uint (const state_t state, const std::size_t pos)
ulong_int_t state_pos_to_ulong_int (const state_t state, const std::size_t pos)
void uint_to_state_pos (const state_t state, const std::size_t pos, const ushort_int_t value)
void ulong_int_to_state_pos (const state_t state, const std::size_t pos, const ulong_int_t value)


Detailed Description

The main contribution of this file is a class state_t and methods for the work with it (especially new_state(), delete_state(), state_pos_to_*() functions *_to_state_pos() functions and functions for comparing states.

Function Documentation

state_t new_state ( char *const   state_memory,
const std::size_t  size 
)

Creates a new state and returns a pointer to it.

Parameters:
state_memory = pointer to the memory representing a state of the system - the content will be copied to the
size = size of the memory referenced by `state_memory' in bytes

References state_t::ptr, and state_t::size.

void set_to_state_pos ( const state_t  state,
const std::size_t  pos,
const T  value 
) [inline]

Sets the value of type `T' to `state' at the position `pos'.

Sets the value of type T to state at position pos. It can be instatiated by the following types T :

  • byte_t
  • sshort_int_t
  • ushort_int_t
  • ulong_int_t

T state_pos_to ( const state_t  state,
const std::size_t  pos 
) [inline]

Returns the value of type `T' stored in `state' at the position `pos'.

Returns the value of type T stored in state at the position pos It can be instatiated by the following types T :

  • byte_t
  • sshort_int_t
  • ushort_int_t
  • ulong_int_t


Reference Manual for Library, 2006 developed in ParaDiSe laboratory, Faculty of Informatics, Masaryk University