commsfwsupport/commselements/rootserver/inc/rscommon.inl
changeset 0 dfb7c4ff071f
equal deleted inserted replaced
-1:000000000000 0:dfb7c4ff071f
       
     1 // Copyright (c) 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 //
       
    15 // rscommon.inl
       
    16 //
       
    17 
       
    18 
       
    19 #if !defined(__RSSHARED_INL__)
       
    20 #define __RSCOMMON_INL__
       
    21 
       
    22 /**
       
    23     Default constructor for TRSStartModuleParamContainer
       
    24 */
       
    25 inline TRSStartModuleParamContainer::TRSStartModuleParamContainer()
       
    26     {
       
    27     iPriority = EPriorityNull;
       
    28     iStackSize = -1;
       
    29     iHeapType = EDefaultHeap;
       
    30     iMinHeapSize = -1;
       
    31     iMaxHeapSize = -1;
       
    32     iThreadFunctionOrdinal = -1;
       
    33     iIsSticky = EFalse;
       
    34     iIsServer = EFalse;
       
    35     iControlFlags = 0;
       
    36     }
       
    37 
       
    38 
       
    39 
       
    40 inline TRSStartModuleParams::TRSStartModuleParams(const CommsFW::TCFModuleName& aName, const TFileName& aFileName,
       
    41 												  const TThreadPriority aPriority, TInt aStackSize,
       
    42 												  const TRSHeapType aHeapType, TInt aMinHeapSize,
       
    43 												  TInt aMaxHeapSize, const CommsFW::TCFModuleName& aShareHeapWith,
       
    44 												  TInt aThreadFunctionOrdinal, TBool aIsSticky, TUint32 aControlFlags):
       
    45 TPckg<TRSStartModuleParamContainer>(iParams)
       
    46 	/**	Constructor; copies the parameters.
       
    47     @param aName Name of the module and its thread.
       
    48 	@param aFileName Filename of the Comms Provider Module DLL.
       
    49 	@param aPriority Priority of the CPM thread.
       
    50 	@param aStackSize Initial size of the stack.
       
    51 	@param aHeapType Type of the heap for the module.
       
    52 	@param aMinHeapSize Minimum size of the heap for the module.
       
    53 	@param aMaxHeapSize Maximum size of the heap for the module.
       
    54 	@param aShareHeapWith If the module are to share the heap with an existing module this must be the name	of the other module.
       
    55 	@param aThreadFunctionOrdinal Ordinal of the CPM main thread function, or entrypoint, in the DLL.
       
    56 	@param aIsSticky If ETrue specifies that this module can not be unloaded.
       
    57 	@param aControlFlags modle thread control flags
       
    58 	
       
    59 	@see TCFModuleName
       
    60 	@see TFileName
       
    61 	@see TThreadPriority
       
    62 	@see TRSHeapType
       
    63 	@see TRSBindType
       
    64 	*/	
       
    65 	{
       
    66 	iParams.iName = aName;
       
    67 	iParams.iFilename = aFileName;
       
    68 	iParams.iPriority = aPriority;
       
    69 	iParams.iStackSize = aStackSize;
       
    70 	iParams.iHeapType = aHeapType;
       
    71 	iParams.iMinHeapSize = aMinHeapSize;
       
    72 	iParams.iMaxHeapSize = aMaxHeapSize;
       
    73 	iParams.iShareHeapWith = aShareHeapWith;
       
    74 	iParams.iThreadFunctionOrdinal = aThreadFunctionOrdinal;
       
    75 	iParams.iIsSticky = aIsSticky;
       
    76 	iParams.iControlFlags = aControlFlags;
       
    77 	}
       
    78 
       
    79 inline TRSStartModuleParams::TRSStartModuleParams(const CommsFW::TCFModuleName& aName, const TFileName& aFileName,
       
    80 												  const TThreadPriority aPriority, TInt aStackSize,
       
    81 												  const TRSHeapType aHeapType, TInt aMinHeapSize,
       
    82 												  TInt aMaxHeapSize, TInt aThreadFunctionOrdinal,
       
    83 												  TBool aIsSticky, TUint32 aControlFlags):
       
    84 TPckg<TRSStartModuleParamContainer>(iParams)
       
    85 	/**	Constructor; copies the parameters.
       
    86     @param aName Name of the module and its thread.
       
    87 	@param aFileName Filename of the Comms Provider Module DLL.
       
    88 	@param aPriority Priority of the CPM thread.
       
    89 	@param aStackSize Initial size of the stack.
       
    90 	@param aHeapType Type of the heap for the module.
       
    91 	@param aMinHeapSize Minimum size of the heap for the module.
       
    92 	@param aMaxHeapSize Maximum size of the heap for the module.
       
    93 	@param aThreadFunctionOrdinal Ordinal of the CPM main thread function, or entrypoint, in the DLL.
       
    94 	@param aIsSticky If ETrue specifies that this module can ot be unloaded.
       
    95 	@param aControlFlags modle thread control flags
       
    96 	
       
    97 	@see TCFModuleName
       
    98 	@see TFileName
       
    99 	@see TThreadPriority
       
   100 	@see TRSHeapType
       
   101 	@see TRSBindType
       
   102 	*/	
       
   103 	{
       
   104 	iParams.iName = aName;
       
   105 	iParams.iFilename = aFileName;
       
   106 	iParams.iPriority = aPriority;
       
   107 	iParams.iStackSize = aStackSize;
       
   108 	iParams.iHeapType = aHeapType;
       
   109 	iParams.iMinHeapSize = aMinHeapSize;
       
   110 	iParams.iMaxHeapSize = aMaxHeapSize;
       
   111 	iParams.iThreadFunctionOrdinal = aThreadFunctionOrdinal;
       
   112 	iParams.iIsSticky = aIsSticky;
       
   113 	iParams.iControlFlags = aControlFlags;
       
   114 	}
       
   115 
       
   116 inline TRSStartModuleParams::TRSStartModuleParams(const CommsFW::TCFModuleName& aName, const TFileName& aFileName,
       
   117 												  const TThreadPriority aPriority, TInt aStackSize,
       
   118 												  const TRSHeapType aHeapType, TInt aThreadFunctionOrdinal, 
       
   119 												  TBool aIsSticky, TUint32 aControlFlags):
       
   120 TPckg<TRSStartModuleParamContainer>(iParams)
       
   121 	/**	Constructor; copies the parameters.
       
   122     @param aName Name of the module and its thread.
       
   123 	@param aFileName Filename of the Comms Provider Module DLL.
       
   124 	@param aPriority Priority of the CPM thread.
       
   125 	@param aStackSize Initial size of the stack.
       
   126 	@param aHeapType Type of the heap for the module.
       
   127 	@param aThreadFunctionOrdinal Ordinal of the CPM main thread function, or entrypoint, in the DLL.
       
   128 	@param aIsSticky If ETrue specifies that this module can ot be unloaded.
       
   129 	@param aControlFlags modle thread control flags
       
   130 	
       
   131 	@see TCFModuleName
       
   132 	@see TFileName
       
   133 	@see TThreadPriority
       
   134 	@see TRSHeapType
       
   135 	@see TRSBindType
       
   136 	*/
       
   137 	{
       
   138 	iParams.iName = aName;
       
   139 	iParams.iFilename = aFileName;
       
   140 	iParams.iPriority = aPriority;
       
   141 	iParams.iStackSize = aStackSize;
       
   142 	iParams.iHeapType = aHeapType;
       
   143 	iParams.iMinHeapSize = 0;
       
   144 	iParams.iMaxHeapSize = 0;
       
   145 	iParams.iThreadFunctionOrdinal = aThreadFunctionOrdinal;
       
   146 	iParams.iIsSticky = aIsSticky;
       
   147 	iParams.iControlFlags = aControlFlags;
       
   148 	}
       
   149 
       
   150 inline TRSModuleInfo::TRSModuleInfo(const CommsFW::TCFModuleName aName, const TFileName& aDll,
       
   151 									TRSModuleState aState, TInt aNumSubModules):
       
   152 TPckg<TRSModuleInfoContainer>(iParams)
       
   153 	/** Constructor; Copies the parameters.
       
   154 	@param aName Name of the module.
       
   155 	@param aDll Filename of the CPM DLL.
       
   156 	@param aState State of the CPM.
       
   157 	@param aNumSubModules Number of submodules this module has reported. 
       
   158 	*/
       
   159 	{
       
   160 	iParams.iName = aName;
       
   161 	iParams.iDll = aDll;
       
   162 	iParams.iState = aState;
       
   163 	iParams.iNumSubModules = aNumSubModules;
       
   164 	}
       
   165 
       
   166 inline TRSSubModuleAddress::TRSSubModuleAddress(const CommsFW::TCFSubModuleAddress& aAddress):
       
   167 TPckg<CommsFW::TCFSubModuleAddress>(iAddress)  
       
   168 	/** Constructor; copies the parameter.
       
   169 	@param aAddress The fully qualified address of the submodule.
       
   170 	@see TCFSubModuleAddress
       
   171 	*/	
       
   172 	{
       
   173 	iAddress = aAddress;
       
   174 	};
       
   175 
       
   176 inline TRSSubModuleAddress::TRSSubModuleAddress(const CommsFW::TCFModuleName& aModule, const CommsFW::TCFSubModuleName& aSubModule):
       
   177 TPckg<CommsFW::TCFSubModuleAddress>(iAddress) 
       
   178 	/** Constructor; copies the parameters.
       
   179 	@param aModule The name of the module containing the submodule.
       
   180 	@param aSubModule The name of the submodule within aModule.
       
   181 	*/	
       
   182 	{
       
   183 	iAddress.SetModule(aModule);
       
   184 	iAddress.SetSubModule(aSubModule);
       
   185 	};
       
   186 
       
   187 inline TRSBindingInfo::TRSBindingInfo(const TRSBindType& aType, const CommsFW::TCFSubModuleAddress& aAddress1,
       
   188 									  const CommsFW::TCFSubModuleAddress& aAddress2,
       
   189 						  			  TInt aForwardQLength, TInt aReverseQLength):
       
   190 TPckg<TRSBindingInfoContainer>(iParams)
       
   191 	/** Constructor; copies the parameters.
       
   192 	@param aType Type of binding.
       
   193 	@param aAddress1 Fully qualified address of the first submodule.
       
   194 	@param aAddress2 Fully qualified address of the second submodule.
       
   195 	@param aForwardQLength The number of slots in the forward queue.
       
   196 	@param aReverseQLength The number of slots in the reverse direction.
       
   197 	@see TCFSubModuleAddress
       
   198 	@see TRSBindType
       
   199 	 */
       
   200 	{
       
   201 	iParams.iType = aType;
       
   202 	iParams.iAddress1 = aAddress1;
       
   203 	iParams.iAddress2 = aAddress2;
       
   204 	iParams.iState1 = KErrNone;
       
   205 	iParams.iState2 = KErrNone;
       
   206 	iParams.iForwardQLength = aForwardQLength;
       
   207 	iParams.iReverseQLength = aReverseQLength;
       
   208 	}
       
   209 
       
   210 /** A copy constructor for the TRSBindingInfo class
       
   211 */
       
   212 inline TRSBindingInfo::TRSBindingInfo(const TRSBindingInfo &aRef)
       
   213 	:TPckg<TRSBindingInfoContainer>(aRef)
       
   214     {
       
   215     iParams = aRef.iParams;    
       
   216     iPtr = REINTERPRET_CAST(TUint8*, &iParams);
       
   217     }
       
   218 
       
   219 inline TRSBindingInfo& TRSBindingInfo::operator=(const TRSBindingInfo& aInfo)
       
   220 	/** Assignment operator, copies the content of the right side to the
       
   221 		instance on the left side.
       
   222 		@param aInfo The TRSBindingInfo instance to copy from.
       
   223 	*/
       
   224 	{
       
   225 	iParams=aInfo.iParams;
       
   226 	iPtr = REINTERPRET_CAST(TUint8*, &iParams);
       
   227 	return *this;
       
   228 	}
       
   229 
       
   230 inline TRSBindingInfoContainer& TRSBindingInfoContainer::operator=(const TRSBindingInfoContainer& aInfo)
       
   231 	/** Assignment operator, copies the content of the right side to the
       
   232 		instance on the left side.
       
   233 		@param aInfo The TRSBindingInfoContainer instance to copy from.
       
   234 	*/
       
   235 	{
       
   236 	iType=aInfo.iType;
       
   237 	iAddress1=aInfo.iAddress1;
       
   238 	iAddress2=aInfo.iAddress2;
       
   239 	iState1=aInfo.iState1;
       
   240 	iState2=aInfo.iState2;
       
   241 	iForwardQLength=aInfo.iForwardQLength;
       
   242 	iReverseQLength=aInfo.iReverseQLength;
       
   243 	return *this;
       
   244 	}
       
   245 
       
   246 inline TRSUnBindingInfo::TRSUnBindingInfo(const CommsFW::TCFSubModuleAddress aAddress1, const CommsFW::TCFSubModuleAddress aAddress2):
       
   247 TPckg<TRSUnBindingInfoContainer>(iParams)
       
   248 	/** 
       
   249 	@param aAddress1 Fully qualified address of the first submodule.
       
   250 	@param aAddress2 Fully qualified address of the second submodule.
       
   251 	@see TCFSubModuleAddress
       
   252 	 */
       
   253 	{
       
   254 	iParams.iAddress1 = aAddress1;
       
   255 	iParams.iAddress2 = aAddress2;
       
   256 	iParams.iState1 = KErrNone;
       
   257 	iParams.iState2 = KErrNone;
       
   258 	}
       
   259 
       
   260 inline TRSIter::TRSIter()
       
   261 : iPosition(0)
       
   262 	/** Constructor; initializes the iterator to first position.
       
   263 	*/
       
   264 	{ }
       
   265 
       
   266 inline const TInt& TRSIter::operator()() const
       
   267 	/** Returns the current position of the iteration. Note that does not 
       
   268 	relate directly to the position of a specific module.
       
   269 	*/
       
   270 	{
       
   271 	return iPosition;
       
   272 	}
       
   273 
       
   274 inline TInt& TRSIter::operator()()
       
   275 	/** Returns a reference to the iteration count. Note that does not 
       
   276 	relate directly to the position of a specific module.
       
   277 	*/
       
   278 	{
       
   279 	return iPosition;
       
   280 	}
       
   281 
       
   282 inline void TRSIter::Reset()
       
   283 	/** Resets the iteration to start from the beginning.
       
   284 	*/
       
   285 	{
       
   286 	iPosition = 0;
       
   287 	}
       
   288 
       
   289 #endif // __RSCOMMON_INL__
       
   290