InetTransportManager Class Reference

A service manager that holds its InetTransports in an STL map. More...

#include <InetTransportManager.h>

Inheritance diagram for InetTransportManager:

[legend]
Collaboration diagram for InetTransportManager:
[legend]
List of all members.

Public Member Functions

 InetTransportManager ()
 constructor
virtual ~InetTransportManager ()
 destructor
void serveForever ()
 Run active transports.
void runCycle ()
 Run active transports once.
void runCycle (const int timeout)
 Run active transports once with given timeout.
void addInetTransport (InetTransport *const itrans)
 Add an InetTransport to the map of active transports.
void delInetTransport (InetTransport *const itrans)
 Remove a transport from the map of active transports.
void addService (Service *const service)
 Add a service to the map of active transport.
void delService (Service *const service)
 Remove a service from the map of active transports.
void getTransports (std::vector< InetTransport * > &transports) const
 get pointers to transports in a vector

Protected Member Functions

bool addHandleToPollfd (const int handle)
 add handle entry to _pollfd
bool delHandleFromPollfd (const int handle)
 delete handle entry from _pollfd
void showState ()
 show state of this object (for debugging)
void validatePollfd ()
 show contents of _pollfd struct array (for debugging)

Detailed Description

A service manager that holds its InetTransports in an STL map.

Author:
Daniel Holth

Martin Rumori


Member Function Documentation

bool InetTransportManager::addHandleToPollfd const int  handle  )  [protected]
 

add handle entry to _pollfd

Parameters:
sd socket descriptor to add
Returns:
true on success, false on failure

void InetTransportManager::addInetTransport InetTransport *const   itrans  ) 
 

Add an InetTransport to the map of active transports.

Parameters:
itrans a pointer to the InetTransport to add

void InetTransportManager::addService Service *const   service  )  [virtual]
 

Add a service to the map of active transport.

Parameters:
service a pointer to the service to add
Note:
since this ServiceManager is dedicated to the use with InetTransport, arguments to this function will get tried to dynamic cast them to (InetTransport *). if that fails, no action will be performed. use addInetTransport to avoid the overhead of the dynamic cast

Implements ServiceManager.

bool InetTransportManager::delHandleFromPollfd const int  handle  )  [protected]
 

delete handle entry from _pollfd

Parameters:
sd socket descriptor to delete
Returns:
true on success, false on failure

void InetTransportManager::delInetTransport InetTransport *const   itrans  ) 
 

Remove a transport from the map of active transports.

Parameters:
itrans a pointer to the InetTransport to remove

void InetTransportManager::delService Service *const   service  )  [virtual]
 

Remove a service from the map of active transports.

Parameters:
service a pointer to the service to remove
Note:
since this ServiceManager is dedicated to the use with InetTransports, arguments to this function will get tried to dynamic cast them to (InetTransport *). if that fails, no action will be performed. use addInetTransport to avoid the overhead of the dynamic cast

Implements ServiceManager.

void InetTransportManager::getTransports std::vector< InetTransport * > &  transports  )  const
 

get pointers to transports in a vector

Parameters:
transports the transport vector to fill with the pointers
Note:
the pointers to the transports will be simply pushed back to the vector. to have to ensure that it is empty before calling getTransports() by yourself

void InetTransportManager::runCycle const int  timeout  ) 
 

Run active transports once with given timeout.

This method looks for activity on all ports listened to by the transports in the transport map and calls all necessary transports to process the data.

Note:
This method is useful if you want to use this class synchronized from another mainloop ("poll").
Parameters:
timeout the timeout in milliseconds to wait on socket events

void InetTransportManager::runCycle  ) 
 

Run active transports once.

This method looks for activity on all ports listened to by the transports in the transport map and calls all necessary transports to process the data.

Note:
This method is equivalent to runCylce(int timeout) with a timeout of 0.

void InetTransportManager::serveForever  ) 
 

Run active transports.

This method waits for activity on all ports listened to by the transports in the transport map and calls the corresponding transports if necessary.

Note:
This method never stops listening.


The documentation for this class was generated from the following files:
Generated on Thu Mar 2 23:51:35 2006 for libOSC++ by  doxygen 1.4.6