serialserver/c32serialserver/INC/cs_common.h
changeset 0 dfb7c4ff071f
equal deleted inserted replaced
-1:000000000000 0:dfb7c4ff071f
       
     1 // Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // top-level header file for C32 that defines some pervasive values and classes and
       
    15 // other things to generally avoid circular import problems.
       
    16 // 
       
    17 //
       
    18 
       
    19 /**
       
    20  @file
       
    21  @internalComponent 
       
    22 */
       
    23 
       
    24 #ifndef CS_COMMON_H
       
    25 #define CS_COMMON_H
       
    26 
       
    27 #include <elements/cftransport.h>
       
    28 
       
    29 class CC32Dealer;
       
    30 class CC32Player;
       
    31 class CCommSession;
       
    32 
       
    33 class CC32WorkerThread;
       
    34 
       
    35 // Decided to have 9 threads. One main dealer (can have co-resident player) and eight player threads
       
    36 const TInt KMaxWorkerThreadId = 8;
       
    37 const TInt KMainThreadId=0;
       
    38 
       
    39 
       
    40 
       
    41 
       
    42 
       
    43 NONSHARABLE_CLASS(TC32WorkerThreadPublicInfo) : public CommsFW::TWorkerThreadDataBase
       
    44 	{
       
    45 public:
       
    46 	enum {
       
    47 	    ENullWorkerId      = 0xFFFF,     //< Non-existent worker
       
    48 		EMainThread        = 0,		//< the Pit Boss and Main Dealer run here
       
    49 		EFirstPlayerThread = 1,	//< Lowest possible player id
       
    50 		EMaxWorkerThreadId = KMaxWorkerThreadId	//< Highest possible player id (NB: this is an inclusive bound. Be very careful in array-bound contexts!)
       
    51 		};
       
    52 
       
    53 	CC32WorkerThread* iWorker;
       
    54 	};
       
    55 
       
    56 
       
    57 /**
       
    58 @class
       
    59 TC32WorkerThreadRegister
       
    60 Structure containing information pertaining to a particular worker thread.
       
    61 */
       
    62 NONSHARABLE_CLASS(TC32WorkerThreadRegister) : public TC32WorkerThreadPublicInfo
       
    63 	{
       
    64 	friend class CC32Dealer;
       
    65 	friend class CC32Player;
       
    66 	friend class CC32WorkerThread;
       
    67 	typedef TC32WorkerThreadPublicInfo inherited;
       
    68 public:
       
    69 	TC32WorkerThreadRegister();
       
    70 
       
    71 private:
       
    72 	void Clear();
       
    73 
       
    74 private:
       
    75 	CC32Dealer* iDealer;			//< Dealer instance of the worker thread (if exists).
       
    76 	CC32Player* iPlayer;			//< Player instance of the worker thread (if exists).
       
    77 #ifdef _DEBUG
       
    78   	TBool iHasGlobalAllocFails;
       
    79 #endif
       
    80 	};
       
    81 
       
    82 
       
    83 #endif // CS_COMMON_H
       
    84 
       
    85