ot::TCPModule Class Reference
[Network Classes]

#include <TCPModule.h>

Inheritance diagram for ot::TCPModule:

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

Collaboration graph
[legend]
List of all members.

Detailed Description

TCPModule implements a multithreaded module to serve a list of clients with a stream of data captured by TCPSink nodes via TCP. The thread is to establish new connections, in the main thread the sinks are checked for new data and their data is send over the connections. There is no guaranteed order in which the connection data is send.

The protocol in detail is :

Author:
Gerhard Reitmayr


Public Member Functions

 TCPModule ()
 ~TCPModule ()
NodecreateNode (const std::string &name, StringTable &attributes)
void pullEvent ()
void close ()
void init (StringTable &attributes, ConfigNode *localTree)
void start ()

Protected Member Functions

void run ()

Protected Attributes

NodeVector sinks
 list of sink nodes
std::vector< ACE_SOCK_Stream * > connections
 list of sockets that connect to clients
int port
 port number to listen to
int running
 flag to stop the listening thread


Constructor & Destructor Documentation

ot::TCPModule::TCPModule  )  [inline]
 

ot::TCPModule::~TCPModule  ) 
 


Member Function Documentation

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

closes the module. In this implementation it stops the thread. Be sure to call this method from your subclasses close method to stop the thread !

Reimplemented from ot::ThreadModule.

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

This method tries to create a new Node based on a given element type and the attributes of the element. If it can not create a new Node ( because it doesn't know about the element type for example ), it returns NULL. This method has to be implemented by real NodeFactories.

Parameters:
name reference to string containing element name
attributes 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::TCPModule::init StringTable attributes,
ConfigNode localTree
[virtual]
 

initializes the tracker module. This class provides an implementation that sets the initialization flag to true. Subclasses should call this method, if they override it, before doing anything else. It takes the attributes of the element configuring this module and a local tree consisting of the children of the element. This tree must be build of Nodes.

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::TCPModule::pullEvent  )  [virtual]
 

pulls event information out of the tracker tree. It enables the module to query any EventQueue or TimeDependend node in the shared memory. It is called after pushEvent was executed on each module.

Reimplemented from ot::Module.

void ot::TCPModule::run  )  [protected, virtual]
 

the work method for the module thread. This is executed by the new module thread. In this class it does nothing but subclasses should override it to add their implementation.

Reimplemented from ot::ThreadModule.

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

This method is called after initialisation is finished and before the main loop is started. In this implementation it starts the thread. Be sure to call this method from your subclasses start method to start the thread !

Reimplemented from ot::ThreadModule.


Member Data Documentation

std::vector<ACE_SOCK_Stream *> ot::TCPModule::connections [protected]
 

list of sockets that connect to clients

int ot::TCPModule::port [protected]
 

port number to listen to

int ot::TCPModule::running [protected]
 

flag to stop the listening thread

NodeVector ot::TCPModule::sinks [protected]
 

list of sink nodes


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