epoc32/include/ss_std.inl
author William Roberts <williamr@symbian.org>
Wed, 31 Mar 2010 12:27:01 +0100
branchSymbian2
changeset 3 e1b950c65cb4
permissions -rw-r--r--
Attempt to represent the S^2->S^3 header reorganisation as a series of "hg rename" operations
     1 // Copyright (c) 1997-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 the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
     7 //
     8 // Initial Contributors:
     9 // Nokia Corporation - initial contribution.
    10 //
    11 // Contributors:
    12 //
    13 // Description:
    14 // CSocketServer
    15 // 
    16 //
    17 
    18 inline CWorkerThread& CSocketServer::WorkerThread() const 
    19 	{
    20 	return *iOwnerThread;
    21 	};
    22 
    23 inline TWorkerId CSocketServer::WorkerId() const
    24 	{
    25 	return WorkerThread().WorkerId();
    26 	}
    27 
    28 //
    29 // CSockSession
    30 //
    31 
    32 inline const CDealer& CSockSession::Dealer() const 
    33 	{ 
    34 	// NB: this is really only a static_cast<> but the Gordian knot of class dependencies results in a forward
    35 	// declaration
    36 	return *reinterpret_cast<const CDealer*>(Server());	
    37 	}
    38 
    39 inline CSubSessionIx& CSockSession::SubSessions()
    40 	{
    41 	return iSubSessions;
    42 	}
    43 
    44 inline const CSubSessionIx& CSockSession::SubSessions() const
    45 	{
    46 	return iSubSessions;
    47 	}
    48 
    49 inline TSockManData* CSockSession::SockManGlobals() const
    50     {
    51         return WorkerThread().SockManGlobals();
    52     }
    53 
    54 //
    55 // CSockSubSession
    56 //
    57 
    58 inline void CSockSubSession::Open()
    59 	{
    60 	iAccessCount++;
    61 	}
    62 
    63 inline void CSockSubSession::Close()
    64 	{
    65 	iAccessCount--;
    66 	ASSERT(iAccessCount >= 0);
    67 	if(iAccessCount == 0)
    68 		{
    69 		RemoveAndDestroy();
    70 		}
    71 	}
    72 
    73 inline TInt CSockSubSession::AccessCount() const
    74 	{
    75 	return iAccessCount;
    76 	}
    77 
    78 inline CSockSession* CSockSubSession::Session()
    79 	{ 
    80 	ASSERT(iSession); 
    81 	return iSession;
    82 	}
    83 
    84 inline CPlayer& CSockSubSession::Player() const 
    85 	{ 
    86 	ASSERT(iPlayer); 
    87 	return *iPlayer; 
    88 	}
    89 
    90 #ifdef SYMBIAN_NETWORKING_PERFMETRICS
    91 inline void CSockSubSession::IncludePerformanceData(TInt aDeltaClientRxBytes, TInt aDeltaClientRxBuffBytes, TInt aDeltaClientTxBytes)
    92 	{
    93 	iSession->IncludePerformanceData(aDeltaClientRxBytes, aDeltaClientRxBuffBytes, aDeltaClientTxBytes);
    94 	}
    95 #endif
    96 
    97 
    98 inline const RMessage2& CSockSession::Message() const
    99 	{ 
   100 	return *iOurMessage; 
   101 	}
   102 	
   103 inline void CSockSession::CompleteDisconnect()
   104 	{
   105 	RMessage2 dm = iDisconnectMessage;
   106 	inherited::Disconnect(dm);
   107 	}
   108 
   109 
   110 inline void CSocketScheduler::SetGlobals(TSockManData* aGlobals)
   111     { 
   112 	static_cast<CSocketScheduler*>(CActiveScheduler::Current())->iGlobals = aGlobals; 
   113 	}
   114 
   115 //inline void CSocketScheduler::SetWaitHook(TCallBack* aCall)
   116 //	{ ((CSocketScheduler*)CActiveScheduler::Current())->iWaitHook=aCall; }
   117 
   118 inline TSockManData* CSocketScheduler::Globals()
   119 	{ 
   120 	return static_cast<CSocketScheduler*>(CActiveScheduler::Current())->iGlobals; 
   121 	}
   122 
   123 //
   124 // CSubSessionIx
   125 // 
   126 
   127 /**
   128 Optional locking. When accessing any of the public methods of this class in a multithreaded 
   129 environment, locking is often necessary. This lock does not allow for lock nesting.
   130 */
   131 inline void CSubSessionIx::Lock() const
   132 	{ 
   133 	iLock.Wait(); 
   134 	}
   135 
   136 /**
   137 Unlocking.
   138 @see Lock()
   139 */
   140 inline void CSubSessionIx::Unlock() const
   141 	{ 
   142 	iLock.Signal(); 
   143 	}
   144 
   145 /**
   146 @return the number of active sub-sessions in the container.
   147 */
   148 inline TInt CSubSessionIx::ActiveCount() const
   149 	{
   150 	return iActiveCount;
   151 	}