rasdaman complete source
Public Member Functions | Protected Member Functions | List of all members
akg::NbCommunicator Class Reference

#include <akgnet_nbcomm.hh>

Inheritance diagram for akg::NbCommunicator:
akg::GenericServer

Public Member Functions

 NbCommunicator () throw ()
 Default constructor. More...
 
 NbCommunicator (int newMaxJobs)
 Constructor setting also the maximal number of simultan jobs. More...
 
 ~NbCommunicator () throw ()
 Destructor. More...
 
bool initJobs (int newMaxJobs)
 Sets the maximal number of simultan jobs. More...
 
int getMaxJobs () throw ()
 returns the maximal number of simultan jobs More...
 
bool attachJob (NbJob &) throw ()
 
bool deattachJob (NbJob &) throw ()
 
bool runServer () throw ()
 This runs the main loop for servers, this means it initializes the listen socket first. More...
 
bool runClient () throw ()
 This runs the main loop for clients, this means without initializing the listen socket. More...
 
- Public Member Functions inherited from akg::GenericServer
 GenericServer () throw ()
 Default constructor. More...
 
virtual ~GenericServer () throw ()
 Destructor. More...
 
void shouldExit () throw ()
 Instructs the server to leave the loop (runServer()) More...
 
void setListenPort (int) throw ()
 Sets the listen port. More...
 
int getListenPort () throw ()
 Returns the listen port. More...
 
void setTimeout (int sec, int milisec) throw ()
 
void disableTimeout () throw ()
 Disables timeout, means wait unlimited. More...
 

Protected Member Functions

virtual bool executeBeforeSelect () throw ()
 
virtual bool executeAfterSelect () throw ()
 
virtual bool executeOnTimeout () throw ()
 
- Protected Member Functions inherited from akg::GenericServer
bool initListenSocket (int port, bool nonblocking) throw ()
 Init the listen socket. More...
 
bool connectNewClient (ServerSocket &) throw ()
 
void closeSocket (Socket &) throw ()
 

Additional Inherited Members

- Protected Attributes inherited from akg::GenericServer
ListenSocket listenSocket
 
int listenPort
 
Selector selector
 
bool exitRequest
 

Detailed Description

The heart of the non-blocking communication. It's derived from GenericServer but it is called 'Communicator' since it not only for servers but also for clients You can use this class for most communication purposes, special ones have to reimplement 'executeBeforeSelect()' or 'executeOnTimeout()' A better implementation should use 'vector' Important: new is supposed to throw!

Constructor & Destructor Documentation

akg::NbCommunicator::NbCommunicator ( )
throw (
)

Default constructor.

akg::NbCommunicator::NbCommunicator ( int  newMaxJobs)

Constructor setting also the maximal number of simultan jobs.

akg::NbCommunicator::~NbCommunicator ( )
throw (
)

Destructor.

Member Function Documentation

bool akg::NbCommunicator::attachJob ( NbJob )
throw (
)

Attaches a new job. Returns 'true' if succeded, 'false' if the job is already attached or if the maximal number of jobs is already attached

bool akg::NbCommunicator::deattachJob ( NbJob )
throw (
)

Deattach job. Returns 'true' if succeded, 'false' if the job is not attached

virtual bool akg::NbCommunicator::executeAfterSelect ( )
throw (
)
protectedvirtual

Called after select, if it returns 'false' the loop exits. This version just returns 'true'

virtual bool akg::NbCommunicator::executeBeforeSelect ( )
throw (
)
protectedvirtual

Called before select, if it returns 'false' the loop exits. This version just returns 'true'

virtual bool akg::NbCommunicator::executeOnTimeout ( )
throw (
)
protectedvirtual

Called if select times out, if it returns 'false' the loop exits. This version just returns 'true'

int akg::NbCommunicator::getMaxJobs ( )
throw (
)

returns the maximal number of simultan jobs

bool akg::NbCommunicator::initJobs ( int  newMaxJobs)

Sets the maximal number of simultan jobs.

bool akg::NbCommunicator::runClient ( )
throw (
)

This runs the main loop for clients, this means without initializing the listen socket.

bool akg::NbCommunicator::runServer ( )
throw (
)
virtual

This runs the main loop for servers, this means it initializes the listen socket first.

Implements akg::GenericServer.


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