Classes | Public Member Functions | Protected Member Functions | Protected Attributes

zeus::TAbstractSkel Class Reference

#include <AbstractSkel.h>

Inheritance diagram for zeus::TAbstractSkel:
zeus::TThread zeus::TZObject zeus::IThread zeus::IZUnknown zeus::IZUnknown zeus::TCommPipe_Skel zeus::TMessagePool_Skel zeus::TMessageServerConnection_Skel zeus::TNamedContext_Skel

List of all members.

Classes

class  TClientHandlerThread

Public Member Functions

 TAbstractSkel (bool bHighPerformance=false)
virtual Retval startSkeleton (IString &rAddress, Uint &rPort, bool bDynamic)
virtual void kill (Float64 dTimeOut=5.0)
virtual void execute ()
void dispatch1 (const TCCTPRequest &request, TCCTPResponse &response)
void processAsynchronousCalls ()
Retval getClientSocket (Uint uiThreadID, TSocket *&rpSocket) const
bool isRunning () const
void setCleanFlag ()
void setUseRemoteObjectAsReferencesOnly (bool bFlag)

Protected Member Functions

virtual ~TAbstractSkel ()
virtual Retval dispatchCommand (const IRemoteMethodCall &rMethod, IRemoteMethodCall *&rpMethodreturn)=0
virtual void dispatchAsynchCommand (const IRemoteMethodCall &)
virtual void startNewHandler (TSocket &rClient)
Retval postAsynchronMethod (const IRemoteMethodCall &rMethod)

Protected Attributes

TSingleLinkedList
< TClientHandlerThread * > 
m_lstClients
 List of all available clients.
TCriticalSectionm_rLock
 Lock to protect the client list.
TAutoPtr< TServerSocketm_ptrSocket
 Client Soket to handle.
bool m_bCleanFlag
 Cleaning flag to remove wasted Clienthandler.
bool m_bUseRemoteObjectAsReferencesOnly
 Flag if all remote objects are used as remote references only.

Detailed Description

This class implements n abstract skeleton according to the server client model. The AbstractSkel is the server thread. Each incomming request is handled over a client handler thread, which is a inner class of this server. The method calls are dispatched by the main class using a customized method (overwritten by concrete skeleton class).


Constructor & Destructor Documentation

TAbstractSkel::TAbstractSkel ( bool  bHighPerformance = false )

Creates a abstract skeleton object

Parameters:
bHighPerformance: flag for high performance data communication. false is default.
TAbstractSkel::~TAbstractSkel (  ) [protected, virtual]

Destroys the abstract skeleton


Member Function Documentation

void TAbstractSkel::dispatch1 ( const TCCTPRequest request,
TCCTPResponse response 
)

Internal method for dispatching using the remote method call technology.

virtual void zeus::TAbstractSkel::dispatchAsynchCommand ( const IRemoteMethodCall  ) [inline, protected, virtual]
virtual Retval zeus::TAbstractSkel::dispatchCommand ( const IRemoteMethodCall rMethod,
IRemoteMethodCall *&  rpMethodreturn 
) [protected, pure virtual]
void TAbstractSkel::execute (  ) [virtual]

Executes the server thread. Listening for incomming reguests

Reimplemented from zeus::TThread.

Retval TAbstractSkel::getClientSocket ( Uint  uiThreadID,
TSocket *&  rpSocket 
) const

Returns the client socket of the connected client. The thread ID is used to distinguish between clients. Use TreadManager to receive the thread id in the running program context.

bool zeus::TAbstractSkel::isRunning (  ) const [inline]

Checks if the skeleton is started (running and the server socket is bound to an address)

void TAbstractSkel::kill ( Float64  dTimeOut = 5.0 ) [virtual]

Kills the server thread

Reimplemented from zeus::TThread.

Retval TAbstractSkel::postAsynchronMethod ( const IRemoteMethodCall rMethod ) [protected]

adds a remote method call into the asynchronous call queue

void TAbstractSkel::processAsynchronousCalls (  )

processes all asynchronous calls

void TAbstractSkel::setCleanFlag (  )

Each terminating client should call this method. If the clean flag is set the skeleton will remove all wasted client handler from its list.

void zeus::TAbstractSkel::setUseRemoteObjectAsReferencesOnly ( bool  bFlag ) [inline]

If the m_bUseRemoteObjectAsReferencesOnly flag is set, no stubs are created on the skeleton side. All remote objects are handled as remote references only

void TAbstractSkel::startNewHandler ( TSocket rClient ) [protected, virtual]

STarts a new client handle. If you want to use an other client handler thread you have to overwrite this method only. Create your own client handler and add it to the m_lstClients object.

Parameters:
rClient,:Socket of the client

Reimplemented in zeus::TCommPipe_Skel.

Retval TAbstractSkel::startSkeleton ( IString rAddress,
Uint &  rPort,
bool  bDynamic 
) [virtual]

Starts the skeleton binding the server socket to a ip address. This method starts the thread after successfully binding the socket.

Parameters:
rAddress: in out parameter for IP address. if the dynamic flag is set this parameter is an out parameter otherwise the address given is used for connecting
rPort: in out parameter for tcp port. If the dynamic falg is set this parameter is the out parameter otherwise the port is used to connect
bDynamic: If this flag is set the socket is bound dynamically to a network interface and an unused tcp port.
Return values:
RET_NOERROR: Server socket bound and thread started
RET_REQUEST_FAILED: Could not bind socket. The server thread hasn't be started.

Member Data Documentation

Cleaning flag to remove wasted Clienthandler.

Flag if all remote objects are used as remote references only.

List of all available clients.

Client Soket to handle.

Lock to protect the client list.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines


Written by Benjamin Hadorn http://www.xatlantis.ch.
Last change made on Sun Jan 22 2012 15:28:30