libraries/clogger/inc/SensibleClient.h
changeset 0 7f656887cf89
equal deleted inserted replaced
-1:000000000000 0:7f656887cf89
       
     1 // SensibleClient.h
       
     2 // 
       
     3 // Copyright (c) 2006 - 2010 Accenture. All rights reserved.
       
     4 // This component and the accompanying materials are made available
       
     5 // under the terms of the "Eclipse Public License v1.0"
       
     6 // which accompanies this distribution, and is available
       
     7 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 // 
       
     9 // Initial Contributors:
       
    10 // Accenture - Initial contribution
       
    11 //
       
    12 
       
    13 #ifndef SENSIBLECLIENT_H
       
    14 #define SENSIBLECLIENT_H
       
    15 
       
    16 #include <e32std.h>
       
    17 
       
    18 class CServerCallbackDispatcher;
       
    19 class TServerCallback;
       
    20 class TCallbackParser;
       
    21 
       
    22 /* This class is designed to be usable in a handle-body implementation. Ie you can hide the use of RSensibleSessionBody 
       
    23  * from your clients by declaring a TUint32 iPimpl[3] (or somesuch) in your client class, and constructing a subclass of
       
    24  * RSensibleSessionBody with appropriate definitions of DoCreateSession and DoSendReceive that call into the real session
       
    25  * object.
       
    26  *
       
    27  * You can also derive directly from RSensibleSessionBody if you're not fussed about hiding the implementation.
       
    28  */
       
    29 
       
    30 NONSHARABLE_CLASS(RSensibleSessionBody)
       
    31 	{
       
    32 	friend class CServerCallbackDispatcher;
       
    33 public:
       
    34 	RSensibleSessionBody();
       
    35 	
       
    36 protected:
       
    37 	void Close();
       
    38 	TInt Connect(TInt aMessageSlots, TBool aStartCallbackDispatcher);
       
    39 	TInt StartCallbackDispatcher(); // If not already started
       
    40 	void StopCallbackDispatcher();
       
    41 	virtual void DispatchCallbackL(TServerCallback& aCallback, TCallbackParser& aParser);
       
    42 	virtual void ServerDiedL();
       
    43 
       
    44 	// These have to be implemented by a derived class to call through to the session proper
       
    45 	virtual TInt DoCreateSession(const TDesC &aServer, const TVersion &aVersion, TInt aAsyncMessageSlots)=0;
       
    46 	virtual TInt DoSendReceive(TInt aFunction, const TIpcArgs &aArgs) const=0;
       
    47 	virtual void DoSendReceive(TInt aFunction, const TIpcArgs &aArgs, TRequestStatus &aStatus) const=0;
       
    48 
       
    49 protected:
       
    50 	CServerCallbackDispatcher* iDispatcher;
       
    51 	};
       
    52 
       
    53 #endif