ZeusBase-Library  2.0.4
zeus::TAbstractSkel Class Referenceabstract

#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

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)
 
- Public Member Functions inherited from zeus::TThread
 TThread (EPriority ePriority=etNormal)
 
 TThread (IRunnable &rObj, EPriority ePriority=etNormal)
 
EPriority getPriority () const
 
void setPriority (EPriority ePriority)
 
virtual bool isAlive () const
 
virtual bool isDead () const
 
virtual void resume ()
 
virtual bool signalizeStop (Float64 dTimeOut=5.0)
 
virtual bool start ()
 
virtual void suspend ()
 
virtual bool yield ()
 
virtual Retval postObject (ISynchronizeObject &rObject, bool bWaitForCompletion)
 
virtual bool MQUALIFIER isInterrupted () const
 
virtual Uint MQUALIFIER getThreadID () const
 
virtual Retval MQUALIFIER askForInterface (const InterfaceID &rInterfaceID, IZUnknown *&rpIface)
 
virtual void MQUALIFIER addRef () const
 
virtual void MQUALIFIER release () const
 
- Public Member Functions inherited from zeus::TZObject
 TZObject ()
 
 TZObject (const TString &strName)
 
 TZObject (const IString &strName)
 
Uint getHash () const
 
TString toString () const
 
virtual TString getObjName () const
 
virtual void setObjName (const TString &name)
 

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 Member Functions inherited from zeus::TThread
virtual ~TThread ()
 
virtual void onTerminated ()
 
virtual void onStarted ()
 
- Protected Member Functions inherited from zeus::TZObject
virtual ~TZObject ()
 
 TZObject (const TZObject &rObject)
 
TZObjectoperator= (const TZObject &rObject)
 
Int getRefCounter () const
 

Protected Attributes

TSingleLinkedList< TClientHandlerThread * > m_lstClients
 List of all available clients. More...
 
TCriticalSectionm_rLock
 Lock to protect the client list. More...
 
TAutoPtr< TServerSocketm_ptrSocket
 Client Soket to handle. More...
 
bool m_bCleanFlag
 Cleaning flag to remove wasted Clienthandler. More...
 
bool m_bUseRemoteObjectAsReferencesOnly
 Flag if all remote objects are used as remote references only. More...
 
- Protected Attributes inherited from zeus::TThread
bool m_bInterrupted
 Flag to check if the thread should terminate. More...
 
TThreadMessageQueuem_rQueue
 Message queue of the thread. More...
 
- Protected Attributes inherited from zeus::TZObject
Uint m_uiID
 

Additional Inherited Members

- Public Types inherited from zeus::TThread
enum  EPriority {
  etNormal = 0, etLow = 1, etHigh = 2, etLower = 3,
  etHigher = 4, etTimeCritical = 5
}
 
- Static Public Member Functions inherited from zeus::TThread
static void sleep (const Float &rfDelay)
 

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::TAbstractSkel ( bool  bHighPerformance = false)

Creates a abstract skeleton object

Parameters
bHighPerformance: flag for high performance data communication. false is default.

§ ~TAbstractSkel()

TAbstractSkel::~TAbstractSkel ( )
protectedvirtual

Destroys the abstract skeleton

Member Function Documentation

§ dispatch1()

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

Internal method for dispatching using the remote method call technology.

§ dispatchAsynchCommand()

virtual void zeus::TAbstractSkel::dispatchAsynchCommand ( const IRemoteMethodCall )
inlineprotectedvirtual

§ dispatchCommand()

virtual Retval zeus::TAbstractSkel::dispatchCommand ( const IRemoteMethodCall rMethod,
IRemoteMethodCall *&  rpMethodreturn 
)
protectedpure virtual

§ execute()

void TAbstractSkel::execute ( )
virtual

Executes the server thread. Listening for incomming reguests

Reimplemented from zeus::TThread.

§ getClientSocket()

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.

§ isRunning()

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

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

§ kill()

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

Kills the server thread

Reimplemented from zeus::TThread.

§ postAsynchronMethod()

Retval TAbstractSkel::postAsynchronMethod ( const IRemoteMethodCall rMethod)
protected

adds a remote method call into the asynchronous call queue

§ processAsynchronousCalls()

void TAbstractSkel::processAsynchronousCalls ( )

processes all asynchronous calls

§ setCleanFlag()

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.

§ setUseRemoteObjectAsReferencesOnly()

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

§ startNewHandler()

void TAbstractSkel::startNewHandler ( TSocket rClient)
protectedvirtual

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
rClientSocket of the client

Reimplemented in zeus::TCommPipe_Skel.

§ startSkeleton()

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

§ m_bCleanFlag

bool zeus::TAbstractSkel::m_bCleanFlag
protected

Cleaning flag to remove wasted Clienthandler.

§ m_bUseRemoteObjectAsReferencesOnly

bool zeus::TAbstractSkel::m_bUseRemoteObjectAsReferencesOnly
protected

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

§ m_lstClients

TSingleLinkedList<TClientHandlerThread*> zeus::TAbstractSkel::m_lstClients
protected

List of all available clients.

§ m_ptrSocket

TAutoPtr<TServerSocket> zeus::TAbstractSkel::m_ptrSocket
protected

Client Soket to handle.

§ m_rLock

TCriticalSection& zeus::TAbstractSkel::m_rLock
protected

Lock to protect the client list.


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


Written by Benjamin Hadorn http://www.xatlantis.ch.
Last change made on Tue Sep 13 2016 22:31:48