OpenTracker

An Open Architecture for Reconfigurable Tracking based on XML | Contact

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
static const short MOVE_X_MINUS
static const short MOVE_Y_PLUS
static const short MOVE_Y_MINUS
static const short MOVE_Z_PLUS
static const short MOVE_Z_MINUS
static const short ROT_X_PLUS
static const short ROT_X_MINUS
static const short ROT_Y_PLUS
static const short ROT_Y_MINUS
static const short ROT_Z_PLUS
static const short ROT_Z_MINUS
static const short ACCELL
static const short BRAKE
static const short BUTTON_1
static const short BUTTON_2
static const short BUTTON_3
static const short BUTTON_4
static const short STATION_0
static const short STATION_1
static const short STATION_2
static const short STATION_3
static const short STATION_4
static const short STATION_5
static const short STATION_6
static const short STATION_7
static const short STATION_8
static const short STATION_9
static const short RESET
static const short QUIT
static const short NEXT_ATTR
static const short ADD_ATTR
static const short DEL_ATTR
static const short CHANGE_ATTR_POS
static const short CHANGE_ATTR_NEG
static const short CHANGE_ATTR_VAL
static const short ACCEL_ANG
static const short BRAKE_ANG

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
NodeVector sources
int cycle
int interval
std::string headerline
float angularSpeed
float posSpeed
int station
int quit
int display
int curses
std::vector< int > keyMap
bool delAttribute
bool addAttribute
bool changeAttrByVal
std::string nameOfAttributeToBeChanged
bool currentChanged
bool stationChanged

Private Types

 POS = 0
 NEG
enum  DIRECTION { POS = 0, NEG }

Detailed Description

Definition at line 181 of file ConsoleModule.h.


Member Enumeration Documentation

Enumerator:
POS 
NEG 

Definition at line 183 of file ConsoleModule.h.


Constructor & Destructor Documentation

ot::ConsoleModule::ConsoleModule (  ) 

constructor method.

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

virtual 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

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

On Unix platforms closes curses.

Reimplemented from ot::Module.

virtual 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

virtual 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

virtual 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.

virtual 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 )

virtual 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.

virtual 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 [static]

Definition at line 366 of file ConsoleModule.h.

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

Definition at line 342 of file ConsoleModule.h.

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

Definition at line 361 of file ConsoleModule.h.

whether the user chose to add a new attribute

Definition at line 211 of file ConsoleModule.h.

angular velocity and positional velocity

Definition at line 197 of file ConsoleModule.h.

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

Definition at line 343 of file ConsoleModule.h.

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

Definition at line 367 of file ConsoleModule.h.

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

Definition at line 344 of file ConsoleModule.h.

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

Definition at line 345 of file ConsoleModule.h.

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

Definition at line 346 of file ConsoleModule.h.

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

Definition at line 347 of file ConsoleModule.h.

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

Definition at line 364 of file ConsoleModule.h.

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

Definition at line 363 of file ConsoleModule.h.

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

Definition at line 365 of file ConsoleModule.h.

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

Definition at line 213 of file ConsoleModule.h.

whether the user switched attribute that is currently subject to change

Definition at line 217 of file ConsoleModule.h.

int ot::ConsoleModule::curses [protected]

should curses be initialized ?

Definition at line 205 of file ConsoleModule.h.

int ot::ConsoleModule::cycle [protected]

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

Definition at line 191 of file ConsoleModule.h.

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

Definition at line 362 of file ConsoleModule.h.

whether the user chose to delete an attribute

Definition at line 209 of file ConsoleModule.h.

int ot::ConsoleModule::display [protected]

is the console module displaying values ?

Definition at line 203 of file ConsoleModule.h.

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

Definition at line 326 of file ConsoleModule.h.

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

headerline in display

Definition at line 195 of file ConsoleModule.h.

int ot::ConsoleModule::interval [protected]

cycle interval to use for printing out events

Definition at line 193 of file ConsoleModule.h.

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

Definition at line 328 of file ConsoleModule.h.

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

maps key chars to indices

Definition at line 207 of file ConsoleModule.h.

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

Definition at line 331 of file ConsoleModule.h.

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

Definition at line 330 of file ConsoleModule.h.

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

Definition at line 333 of file ConsoleModule.h.

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

Definition at line 332 of file ConsoleModule.h.

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

Definition at line 335 of file ConsoleModule.h.

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

Definition at line 334 of file ConsoleModule.h.

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

Definition at line 215 of file ConsoleModule.h.

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

Definition at line 360 of file ConsoleModule.h.

float ot::ConsoleModule::posSpeed [protected]

Definition at line 197 of file ConsoleModule.h.

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

Definition at line 359 of file ConsoleModule.h.

int ot::ConsoleModule::quit [protected]

should the module quit ?

Definition at line 201 of file ConsoleModule.h.

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

Definition at line 358 of file ConsoleModule.h.

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

Definition at line 337 of file ConsoleModule.h.

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

Definition at line 336 of file ConsoleModule.h.

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

Definition at line 339 of file ConsoleModule.h.

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

Definition at line 338 of file ConsoleModule.h.

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

Definition at line 341 of file ConsoleModule.h.

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

Definition at line 340 of file ConsoleModule.h.

list of ConsoleSink nodes in the tree

Definition at line 187 of file ConsoleModule.h.

list of ConsoleSource nodes in the tree

Definition at line 189 of file ConsoleModule.h.

int ot::ConsoleModule::station [protected]

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

Definition at line 199 of file ConsoleModule.h.

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

Definition at line 348 of file ConsoleModule.h.

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

Definition at line 349 of file ConsoleModule.h.

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

Definition at line 350 of file ConsoleModule.h.

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

Definition at line 351 of file ConsoleModule.h.

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

Definition at line 352 of file ConsoleModule.h.

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

Definition at line 353 of file ConsoleModule.h.

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

Definition at line 354 of file ConsoleModule.h.

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

Definition at line 355 of file ConsoleModule.h.

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

Definition at line 356 of file ConsoleModule.h.

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

Definition at line 357 of file ConsoleModule.h.

whether station number or station information changed

Definition at line 219 of file ConsoleModule.h.


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

copyright (c) 2006 Graz University of Technology