ot::ConsoleModule Class Reference

#include <ConsoleModule.h>

Inheritance diagram for ot::ConsoleModule:

Inheritance graph
[legend]
Collaboration diagram for ot::ConsoleModule:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 ConsoleModule ()
virtual ~ConsoleModule ()
virtual void init (StringTable &attributes, ConfigNode *localTree)
virtual NodecreateNode (const std::string &name, StringTable &attributes)
virtual void pushEvent ()
virtual void pullEvent ()
virtual void start ()
virtual void close ()
virtual int stop ()

Public Attributes

std::vector< std::string > functionMap
std::map< std::string, int > keyCodeMap

Static Public Attributes

static const short MOVE_X_PLUS = 1
static const short MOVE_X_MINUS = 2
static const short MOVE_Y_PLUS = 3
static const short MOVE_Y_MINUS = 4
static const short MOVE_Z_PLUS = 5
static const short MOVE_Z_MINUS = 6
static const short ROT_X_PLUS = 7
static const short ROT_X_MINUS = 8
static const short ROT_Y_PLUS = 9
static const short ROT_Y_MINUS = 10
static const short ROT_Z_PLUS = 11
static const short ROT_Z_MINUS = 12
static const short ACCELL = 13
static const short BRAKE = 14
static const short BUTTON_1 = 15
static const short BUTTON_2 = 16
static const short BUTTON_3 = 17
static const short BUTTON_4 = 18
static const short STATION_0 = 20
static const short STATION_1 = 21
static const short STATION_2 = 22
static const short STATION_3 = 23
static const short STATION_4 = 24
static const short STATION_5 = 25
static const short STATION_6 = 26
static const short STATION_7 = 27
static const short STATION_8 = 28
static const short STATION_9 = 29
static const short RESET = 30
static const short QUIT = 31
static const short NEXT_ATTR = 32
static const short ADD_ATTR = 33
static const short DEL_ATTR = 34
static const short CHANGE_ATTR_POS = 35
static const short CHANGE_ATTR_NEG = 36
static const short CHANGE_ATTR_VAL = 37
static const short ACCEL_ANG = 38
static const short BRAKE_ANG = 39

Protected Member Functions

void addAttr (const int station, const std::string type, const std::string name, const std::string value) const
void delAttr (const int station, const std::string name)
void nextAttr (const int station)
void changeAttrToValue (const int station, const std::string value) const
void changeAttr (const int station, const DIRECTION dir) const
void clearLastLines (int lines=-1)
void setButton (int station, int button)
void movePos (int station, float *data)
void rotate (int station, float *data)
void reset (int station)

Protected Attributes

NodeVector sinks
 list of ConsoleSink nodes in the tree
NodeVector sources
 list of ConsoleSource nodes in the tree
int cycle
 current cycle count, for computing when to print out the event again
int interval
 cycle interval to use for printing out events
std::string headerline
 headerline in display
float angularSpeed
 angular velocity and positional velocity
float posSpeed
int station
 currently active station, must be in [0-9]
int quit
 should the module quit ?
int display
 is the console module displaying values ?
int curses
 should curses be initialized ?
std::vector< int > keyMap
 maps key chars to indices
bool delAttribute
 whether the user chose to delete an attribute
bool addAttribute
 whether the user chose to add a new attribute
bool changeAttrByVal
 whether the user chose to change an attribute by typing in the new value
std::string nameOfAttributeToBeChanged
 the name of the attribute that is shown to be subject to change currently
bool currentChanged
 whether the user switched attribute that is currently subject to change
bool stationChanged
 whether station number or station information changed

Constructor & Destructor Documentation

ot::ConsoleModule::ConsoleModule  ) 
 

constructor method. initializes internal and static data such as the functionMap and keyMap tables.

ot::ConsoleModule::~ConsoleModule  )  [virtual]
 

Destructor method, clears nodes member.


Member Function Documentation

void ot::ConsoleModule::addAttr const int  station,
const std::string  type,
const std::string  name,
const std::string  value
const [protected]
 

adds the attribute to the events of all sources belonging to station

Parameters:
station the number of the station to add attribute to
type the generic type name of the new attribute
name the name of the new attribute
value the value of the new attribute

void ot::ConsoleModule::changeAttr const int  station,
const DIRECTION  dir
const [protected]
 

increases or decreases the attribute currently subject to change according to dir

Parameters:
station the number of the station
dir whether too increase or decrease the value

void ot::ConsoleModule::changeAttrToValue const int  station,
const std::string  value
const [protected]
 

changes the attribute that is currently subject to change to value

Parameters:
station the number of the station
value the new value

void ot::ConsoleModule::clearLastLines int  lines = -1  )  [protected]
 

clear the lines last lines of the terminal. If is negative, the entire screen is cleared.

Parameters:
lines the number of lines to be cleared above the current one

void ot::ConsoleModule::close  )  [virtual]
 

On Unix platforms closes curses.

Reimplemented from ot::Module.

Node * ot::ConsoleModule::createNode const std::string &  name,
StringTable attributes
[virtual]
 

This method is called to ruct a new Node. It compares name to the ConsoleSink element name, and if it matches creates a new ConsoleSink node.

Parameters:
name reference to string containing element name refenrence to StringTable containing attribute values
Returns:
pointer to new Node or NULL. The new Node must be allocated with new !

Implements ot::NodeFactory.

void ot::ConsoleModule::delAttr const int  station,
const std::string  name
[protected]
 

deletes the attribute from all events of all sources belonging to station

Parameters:
station the number of the station to add attribute to
name the name of the attribute to be deleted

void ot::ConsoleModule::init StringTable attributes,
ConfigNode localTree
[virtual]
 

initializes the tracker module.

Parameters:
attributes StringTable of elements attribute values. Should be possibly , but is not for convenience.
localTree pointer to root of configuration nodes tree

Reimplemented from ot::Module.

void ot::ConsoleModule::movePos int  station,
float *  data
[protected]
 

moves the position by the given data on all sources that are associated with station. Changes the changed flag on the sources.

Parameters:
station the number of the station to change
data array of 3 floats giving the movement vector

void ot::ConsoleModule::nextAttr const int  station  )  [protected]
 

chooses the next attribute to be subject to change

Parameters:
station the number of the station

void ot::ConsoleModule::pullEvent  )  [virtual]
 

reads out the ConsoleSink nodes current event an prints it to the console. This is done only each length cylce.

Reimplemented from ot::Module.

void ot::ConsoleModule::pushEvent  )  [virtual]
 

checks the console for keyboard input and updates any ConsoleSource nodes accordingly. This happens every cycle and all key presses recorded since are used.

Reimplemented from ot::Module.

void ot::ConsoleModule::reset int  station  )  [protected]
 

resets the data on all sources that are associated with the given station. Changes the changed flag on the sources.

Parameters:
station the number of the station to change

void ot::ConsoleModule::rotate int  station,
float *  data
[protected]
 

rotates the event by the given data on all sources that are associated with station. Changes the changed flag on the sources.

Parameters:
station the number of the station to change
data array of 4 floats giving rotational quaternion

void ot::ConsoleModule::setButton int  station,
int  button
[protected]
 

sets the button bit of given button on all sources that are associated with station. Changes the changed flag on the sources.

Parameters:
station the number of the station to change
button the number of the button to set ( 1 - 4, where 1 corresponds to LSB )

void ot::ConsoleModule::start  )  [virtual]
 

On Unix platforms initializes curses. This method is called after initialisation is finished and before the main loop is started.

Reimplemented from ot::Module.

int ot::ConsoleModule::stop  )  [virtual]
 

tests whether a key was pressed, if so it stops.

Returns:
1 if main loop should stop, 0 otherwise.

Reimplemented from ot::Module.


Member Data Documentation

const short ot::ConsoleModule::ACCEL_ANG = 38 [static]
 

const short ot::ConsoleModule::ACCELL = 13 [static]
 

const short ot::ConsoleModule::ADD_ATTR = 33 [static]
 

bool ot::ConsoleModule::addAttribute [protected]
 

whether the user chose to add a new attribute

float ot::ConsoleModule::angularSpeed [protected]
 

angular velocity and positional velocity

const short ot::ConsoleModule::BRAKE = 14 [static]
 

const short ot::ConsoleModule::BRAKE_ANG = 39 [static]
 

const short ot::ConsoleModule::BUTTON_1 = 15 [static]
 

const short ot::ConsoleModule::BUTTON_2 = 16 [static]
 

const short ot::ConsoleModule::BUTTON_3 = 17 [static]
 

const short ot::ConsoleModule::BUTTON_4 = 18 [static]
 

const short ot::ConsoleModule::CHANGE_ATTR_NEG = 36 [static]
 

const short ot::ConsoleModule::CHANGE_ATTR_POS = 35 [static]
 

const short ot::ConsoleModule::CHANGE_ATTR_VAL = 37 [static]
 

bool ot::ConsoleModule::changeAttrByVal [protected]
 

whether the user chose to change an attribute by typing in the new value

bool ot::ConsoleModule::currentChanged [protected]
 

whether the user switched attribute that is currently subject to change

int ot::ConsoleModule::curses [protected]
 

should curses be initialized ?

int ot::ConsoleModule::cycle [protected]
 

current cycle count, for computing when to print out the event again

const short ot::ConsoleModule::DEL_ATTR = 34 [static]
 

bool ot::ConsoleModule::delAttribute [protected]
 

whether the user chose to delete an attribute

int ot::ConsoleModule::display [protected]
 

is the console module displaying values ?

std::vector<std::string> ot::ConsoleModule::functionMap
 

std::string ot::ConsoleModule::headerline [protected]
 

headerline in display

int ot::ConsoleModule::interval [protected]
 

cycle interval to use for printing out events

std::map<std::string,int> ot::ConsoleModule::keyCodeMap
 

std::vector<int> ot::ConsoleModule::keyMap [protected]
 

maps key chars to indices

const short ot::ConsoleModule::MOVE_X_MINUS = 2 [static]
 

const short ot::ConsoleModule::MOVE_X_PLUS = 1 [static]
 

const short ot::ConsoleModule::MOVE_Y_MINUS = 4 [static]
 

const short ot::ConsoleModule::MOVE_Y_PLUS = 3 [static]
 

const short ot::ConsoleModule::MOVE_Z_MINUS = 6 [static]
 

const short ot::ConsoleModule::MOVE_Z_PLUS = 5 [static]
 

std::string ot::ConsoleModule::nameOfAttributeToBeChanged [protected]
 

the name of the attribute that is shown to be subject to change currently

const short ot::ConsoleModule::NEXT_ATTR = 32 [static]
 

float ot::ConsoleModule::posSpeed [protected]
 

const short ot::ConsoleModule::QUIT = 31 [static]
 

int ot::ConsoleModule::quit [protected]
 

should the module quit ?

const short ot::ConsoleModule::RESET = 30 [static]
 

const short ot::ConsoleModule::ROT_X_MINUS = 8 [static]
 

const short ot::ConsoleModule::ROT_X_PLUS = 7 [static]
 

const short ot::ConsoleModule::ROT_Y_MINUS = 10 [static]
 

const short ot::ConsoleModule::ROT_Y_PLUS = 9 [static]
 

const short ot::ConsoleModule::ROT_Z_MINUS = 12 [static]
 

const short ot::ConsoleModule::ROT_Z_PLUS = 11 [static]
 

NodeVector ot::ConsoleModule::sinks [protected]
 

list of ConsoleSink nodes in the tree

NodeVector ot::ConsoleModule::sources [protected]
 

list of ConsoleSource nodes in the tree

int ot::ConsoleModule::station [protected]
 

currently active station, must be in [0-9]

const short ot::ConsoleModule::STATION_0 = 20 [static]
 

const short ot::ConsoleModule::STATION_1 = 21 [static]
 

const short ot::ConsoleModule::STATION_2 = 22 [static]
 

const short ot::ConsoleModule::STATION_3 = 23 [static]
 

const short ot::ConsoleModule::STATION_4 = 24 [static]
 

const short ot::ConsoleModule::STATION_5 = 25 [static]
 

const short ot::ConsoleModule::STATION_6 = 26 [static]
 

const short ot::ConsoleModule::STATION_7 = 27 [static]
 

const short ot::ConsoleModule::STATION_8 = 28 [static]
 

const short ot::ConsoleModule::STATION_9 = 29 [static]
 

bool ot::ConsoleModule::stationChanged [protected]
 

whether station number or station information changed


The documentation for this class was generated from the following files:
Generated on Wed Feb 28 15:28:02 2007 for NaviTrack by  doxygen 1.4.6