#include <AbstractSkel.h>
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. | |
| TCriticalSection & | m_rLock |
| Lock to protect the client list. | |
| TAutoPtr< TServerSocket > | m_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. | |
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).
| TAbstractSkel::TAbstractSkel | ( | bool | bHighPerformance = false ) |
Creates a abstract skeleton object
| bHighPerformance | : flag for high performance data communication. false is default. |
| TAbstractSkel::~TAbstractSkel | ( | ) | [protected, virtual] |
Destroys the abstract skeleton
| 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] |
Implemented in zeus::TCommPipe_Skel, zeus::TMessagePool_Skel, zeus::TMessageServerConnection_Skel, and zeus::TNamedContext_Skel.
| 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.
| 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.
| 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. |
| RET_NOERROR | : Server socket bound and thread started |
| RET_REQUEST_FAILED | : Could not bind socket. The server thread hasn't be started. |
bool zeus::TAbstractSkel::m_bCleanFlag [protected] |
Cleaning flag to remove wasted Clienthandler.
bool zeus::TAbstractSkel::m_bUseRemoteObjectAsReferencesOnly [protected] |
Flag if all remote objects are used as remote references only.
List of all available clients.
TAutoPtr<TServerSocket> zeus::TAbstractSkel::m_ptrSocket [protected] |
Client Soket to handle.
TCriticalSection& zeus::TAbstractSkel::m_rLock [protected] |
Lock to protect the client list.