OpenTracker

An Open Architecture for Reconfigurable Tracking based on XML | Contact

ot::NetworkSourceModule Class Reference
[Network Classes]

The module and factory to drive the reception of network event updates. More...

#include <NetworkSourceModule.h>

Inheritance diagram for ot::NetworkSourceModule:

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

Collaboration graph
[legend]
List of all members.

Public Member Functions

 NetworkSourceModule ()
virtual ~NetworkSourceModule ()
virtual NodecreateNode (const std::string &name, StringTable &attributes)
virtual void start ()
virtual void close ()
virtual void pushEvent ()

Static Protected Member Functions

static void convertFloatsNToHl (float *floats, float *result, int num)
static void runMulticastReceiver (void *data)
static void runUnicastTransceiver (void *data)
static bool processRecord (NetworkReceiver *receiver)

Protected Attributes

MulticastReceiverVector multicasts
UnicastReceiverVector unicasts

Detailed Description

The module and factory to drive the reception of network event updates.

It builds NetworkSource nodes that insert data from the network into the tracker tree. It uses a thread per multicast group or unicast port to receive and send (if necessary) data.

Author:
Gerhard Reitmayr, Mathis Csisinko, Jochen von Spiczak

Definition at line 85 of file NetworkSourceModule.h.


Constructor & Destructor Documentation

ot::NetworkSourceModule::NetworkSourceModule (  ) 

basic constructor

Definition at line 174 of file NetworkSourceModule.cxx.

ot::NetworkSourceModule::~NetworkSourceModule (  )  [virtual]

destructor

Definition at line 180 of file NetworkSourceModule.cxx.

References multicasts, and unicasts.


Member Function Documentation

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

closes the module and closes any communication sockets and stops thread.

Reimplemented from ot::Module.

Definition at line 443 of file NetworkSourceModule.cxx.

References multicasts, and unicasts.

void ot::NetworkSourceModule::convertFloatsNToHl ( float *  floats,
float *  result,
int  num 
) [static, protected]

Converts num floats from network byte order.

Parameters:
floats pointer to source data
result pointer to result array
num number of floats to convert

Definition at line 203 of file NetworkSourceModule.cxx.

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

This method is called to construct a new Node.

It compares name to the NetworkSource element name, and if it matches creates a new NetworkSource 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.

Definition at line 339 of file NetworkSourceModule.cxx.

References ot::StringTable::get(), LOG_ACE_ERROR(), multicasts, and unicasts.

bool ot::NetworkSourceModule::processRecord ( NetworkReceiver receiver  )  [static, protected]

Processes the received data buffer and writes the decoded data the event of the station defined by the station number.

Parameters:
receiver the network receiver
Returns:
whether the record could be successfully processed

Definition at line 285 of file NetworkSourceModule.cxx.

References FlexibleTrackerDataRecord::bufferLength, ot::NetworkReceiver::dataRec, FlexibleTrackerDataRecord::headerId, ot::magicNum, FlexibleTrackerDataRecord::maxStationNum, ot::NetworkReceiver::mutex, FlexibleTrackerDataRecord::numOfStations, ot::revNum, FlexibleTrackerDataRecord::revNum, and ot::NetworkReceiver::sources.

Referenced by runMulticastReceiver(), and runUnicastTransceiver().

void ot::NetworkSourceModule::pushEvent (  )  [virtual]

pushes event information into the tree.

It checks whether there is new data for any NetworkSource node, copies it into the nodes and calls push on them.

Reimplemented from ot::Module.

Definition at line 458 of file NetworkSourceModule.cxx.

References multicasts, and unicasts.

void ot::NetworkSourceModule::runMulticastReceiver ( void *  data  )  [static, protected]

Runs the multicast receiver thread.

The function reads from the network and parses network packages.

Parameters:
data the multicast receiver

Definition at line 221 of file NetworkSourceModule.cxx.

References ot::NetworkReceiver::dataRec, processRecord(), ot::MulticastReceiver::socket, ot::NetworkReceiver::stop, and ot::Module::stop().

Referenced by start().

void ot::NetworkSourceModule::runUnicastTransceiver ( void *  data  )  [static, protected]

Runs the unicast transceiver thread.

The function reads from and writes to the network and parses network packages.

Parameters:
data the unicast receiver

Definition at line 253 of file NetworkSourceModule.cxx.

References ot::UnicastReceiver::address, ot::NetworkReceiver::dataRec, processRecord(), ot::UnicastReceiver::socket, ot::NetworkReceiver::stop, and ot::Module::stop().

Referenced by start().

void ot::NetworkSourceModule::start (  )  [virtual]

opens the sockets needed for communication and starts the receive thread.

It is called after initialisation is done.

Reimplemented from ot::Module.

Definition at line 424 of file NetworkSourceModule.cxx.

References multicasts, runMulticastReceiver(), runUnicastTransceiver(), and unicasts.


Member Data Documentation

list of multicast groups to listen for

Definition at line 93 of file NetworkSourceModule.h.

Referenced by close(), createNode(), pushEvent(), start(), and ~NetworkSourceModule().

list of unicast receivers to listen for

Definition at line 95 of file NetworkSourceModule.h.

Referenced by close(), createNode(), pushEvent(), start(), and ~NetworkSourceModule().


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

copyright (c) 2006 Graz University of Technology