diff -r f345bda72bc4 -r 43e37759235e Symbian3/Examples/guid-6013a680-57f9-415b-8851-c4fa63356636/_complex_server_8h-source.html --- a/Symbian3/Examples/guid-6013a680-57f9-415b-8851-c4fa63356636/_complex_server_8h-source.html Tue Mar 30 11:56:28 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,203 +0,0 @@ - - -TB10.1 Example Applications: examples/Base/IPC/ClientServer/Complex/ComplexServer.h Source File - - - - -

examples/Base/IPC/ClientServer/Complex/ComplexServer.h

00001 // Copyright (c) 2000-2009 Nokia Corporation and/or its subsidiary(-ies).
-00002 // All rights reserved.
-00003 // This component and the accompanying materials are made available
-00004 // under the terms of "Eclipse Public License v1.0"
-00005 // which accompanies this distribution, and is available
-00006 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
-00007 //
-00008 // Initial Contributors:
-00009 // Nokia Corporation - initial contribution.
-00010 //
-00011 // Contributors:
-00012 //
-00013 // Description:
-00014 //
-00015 
-00016 #if !defined(__ComplexServer_H__)
-00017 #define __ComplexServer_H__
-00018 
-00019 //needed for creating server thread.
-00020 const TUint KDefaultHeapSize=0x10000;
-00021 
-00022 // panic reasons
-00023 enum TCountServPanic
-00024         {
-00025         EBadRequest = 1,
-00026         EBadDescriptor,
-00027         EDescriptorNonNumeric,
-00028         EMainSchedulerError,
-00029         ESvrCreateServer,
-00030         ESvrStartServer,
-00031         ECreateTrapCleanup,
-00032         EBadCounterRemove, 
-00033         EBadSubsessionHandle 
-00034         };
-00035 
-00036 
-00037 
-00038 
-00039 /*
-00040 CCountServer class
-00041 
-00042 Represents the server.
-00043         
-00044 The server starts with the first client connect call.
-00045 Start includes setting up active scheduler, the server active object,
-00046 and the object container index which produces object object containers for each session.
-00047 */
-00048 class CCountServer : public CServer2
-00049         {
-00050 public:
-00051     
-00052 
-00053       // Creates a new session with the server; the function
-00054           // implements the pure virtutal function 
-00055           // defined in class CServer2
-00056         CSession2* NewSessionL(const TVersion &aVersion,const RMessage2& aMessage) const;
-00057 
-00058 public: 
-00059       // Creats a new server object
-00060     static CCountServer* NewL(CActive::TPriority aActiveObjectPriority);
-00061     
-00062       // The thread function executed by the server 
-00063         static TInt ThreadFunction(TAny* aStarted);
-00064 
-00065           // utility function to panic the server.
-00066         static void PanicServer(TCountServPanic aPanic);
-00067 
-00068 public :
-00069       // Constructor
-00070         CCountServer(CActive::TPriority aActiveObjectPriority);
-00071         
-00072           // Second phase constructor
-00073         void ConstructL();
-00074 
-00075           // Returns an object container, and guaranteed 
-00076           // to produce object containers with unique
-00077           // ids within the server.
-00078           // Called by a new session to create a container 
-00079         CObjectCon* NewContainerL();
-00080         
-00081           // Removes container from the container list
-00082         void RemoveContainer(CObjectCon *aCon);
-00083     
-00084           // Destructor; exists to do some tidying up.
-00085         ~CCountServer();
-00086 
-00087 private:
-00088           // The server has an object container index that
-00089           // creates an object container for each session.
-00090         CObjectConIx* iContainerIndex; 
-00091         };
-00092 
-00093 
-00094 
-00095 
-00096 /*
-00097 CCountSession class
-00098 
-00099 Represents a session with the server.
-00100         
-00101 Functions are provided to respond appropriately to client messages.
-00102 A session can own any number of subsession objects.
-00103 */
-00104 class CCountSubSession;
-00105 class CCountSession : public CSession2
-00106         {
-00107 public:
-00108           // Create the session
-00109         static CCountSession* NewL();
-00110         
-00111 public:
-00112       // Constructor
-00113         CCountSession();
-00114         
-00115           // Called by client/server framework after 
-00116           // session has been successfully created
-00117     void CreateL(); 
-00118                 
-00119           // Service request
-00120         void ServiceL(const RMessage2& aMessage);
-00121         void DispatchMessageL(const RMessage2& aMessage);
-00122 
-00123       // Creates new subsession
-00124     void NewCounterL(const RMessage2& aMessage);  
-00125       
-00126       // Closes the session
-00127         void CloseSession();
-00128         
-00129       // Gets the number of resources (i.e. CCountSubSession objects)
-00130         void NumResourcesL(const RMessage2& aMessage);
-00131         
-00132           // Utility to return the CCountSubSession (subsession) object
-00133     CCountSubSession* CounterFromHandle(const RMessage2& aMessage,TInt aHandle);        
-00134 
-00135           // Delete the subsession object through its handle.
-00136         void DeleteCounter(TInt aHandle);
-00137       
-00138       // Gets the number of server-side subsession objects.
-00139         TInt CountResources();
-00140           
-00141           // Panics client
-00142         void PanicClient(const RMessage2& aMessage,TInt aPanic) const;
-00143 
-00144 private:
-00145       // Object container for this session.
-00146         CObjectCon *iContainer;
-00147 
-00148           // Object index which stores objects
-00149           // (CCountSubSession instances) for this session.
-00150         CObjectIx* iCountersObjectIndex;
-00151 
-00152       // Total number of resources. In this example
-00153       // a resource is just the number of CCountSubSession objects.
-00154     TInt iResourceCount;
-00155         };
-00156 
-00157 
-00158 
-00159 
-00160 /*
-00161 CCountSubSession class
-00162 
-00163 Represents a subsession of CCountSession.
-00164 */
-00165 class CCountSubSession : public CObject
-00166         {
-00167 public:
-00168       // creates a new CCountSubSession object.
-00169         static CCountSubSession* NewL(CCountSession* aSession);
-00170         
-00171 public: 
-00172     CCountSubSession(CCountSession* aSession);  
-00173         void ConstructL(CCountSession* aSession);
-00174         void SetFromStringL(const RMessage2& aMessage);
-00175         void Increase();
-00176         void IncreaseBy(const RMessage2& aMessage);
-00177         void Decrease();
-00178         void DecreaseBy(const RMessage2& aMessage);
-00179         void Reset();
-00180         void CounterValueL(const RMessage2& aMessage);
-00181    
-00182 protected:
-00183       // The session that owns this CCountSubSession object.
-00184         CCountSession* iSession;
-00185         
-00186 private:
-00187       // The counter value
-00188         TInt iCount;
-00189         };
-00190 
-00191 #endif
-

Generated on Thu Jan 21 10:32:56 2010 for TB10.1 Example Applications by  - -doxygen 1.5.3
- -