commsfwsupport/commselements/nodemessages/inc/nm_interfaces.h
branchRCL_3
changeset 18 9644881fedd0
parent 0 dfb7c4ff071f
child 24 00c6709d25aa
equal deleted inserted replaced
17:9ddb1d67ebaf 18:9644881fedd0
    31 // Panic category for "absolutely impossible!" vanilla ASSERT()-type panics from this module
    31 // Panic category for "absolutely impossible!" vanilla ASSERT()-type panics from this module
    32 // (if it could happen through user error then you should give it an explicit, documented, category + code)
    32 // (if it could happen through user error then you should give it an explicit, documented, category + code)
    33 _LIT(KSpecAssert_ElemNodeMessIntH, "ElemNodeMessIntH");
    33 _LIT(KSpecAssert_ElemNodeMessIntH, "ElemNodeMessIntH");
    34 #endif
    34 #endif
    35 
    35 
       
    36 // Forward declarations to be used with RNodeInterface to allow for friend assignment
       
    37 namespace ESock
       
    38 	{
       
    39 	class CMMCommsProviderBase;
       
    40 	}
       
    41 
       
    42 namespace CprClientLeaveActivity
       
    43 	{
       
    44 	class CClientLeaveActivity;
       
    45 	}
       
    46 
    36 namespace Messages
    47 namespace Messages
    37 {
    48 {
    38 
    49 
    39 class MTransportSender;
    50 class MTransportSender;
    40 class ANode;
    51 class ANode;
   286 @see TClientType
   297 @see TClientType
   287 */
   298 */
   288 	{
   299 	{
   289 	friend class TClientIterBase;
   300 	friend class TClientIterBase;
   290 
   301 
   291 public:
   302 	// Friend classes needed to allow access to memory preallocation functionality
       
   303 	// This friend funtionality is to be removed when the preallocation functionality is revisited
       
   304 	// These friends are not to be used for any further functionality
       
   305 	friend class ESock::CMMCommsProviderBase;
       
   306 	friend class CprClientLeaveActivity::CClientLeaveActivity;
       
   307 
       
   308 public:
       
   309 	IMPORT_C RNodeInterface();
       
   310 	IMPORT_C virtual ~RNodeInterface();
       
   311 
   292 	IMPORT_C void Open(TNodeId aPostTo, const TClientType& aClientType = TClientType::NullType(), MTransportSender* aSender = NULL);
   312 	IMPORT_C void Open(TNodeId aPostTo, const TClientType& aClientType = TClientType::NullType(), MTransportSender* aSender = NULL);
   293 	IMPORT_C void Close();
   313 	IMPORT_C void Close();
   294 	IMPORT_C TBool operator==(const RNodeInterface& aRHS) const;
   314 	IMPORT_C TBool operator==(const RNodeInterface& aRHS) const;
   295 
   315 
   296 	inline TBool operator==(const TRuntimeCtxId& aRHS) const
   316 	inline TBool operator==(const TRuntimeCtxId& aRHS) const
   365 #else
   385 #else
   366 	    return iClientType.ClearFlags(aFlags);
   386 	    return iClientType.ClearFlags(aFlags);
   367 #endif
   387 #endif
   368 	    }
   388 	    }
   369 
   389 
       
   390 // Handling of preallocating memory to be used by the Leave activity
       
   391 private:
       
   392 	IMPORT_C void PreAllocL(TUint aAllocSize);
       
   393 
       
   394 	/**
       
   395 	Claim some preallocated memory from the RNodeInterface. This preallocated memory is used for activities that
       
   396 	absolutely cannot fail in any scenario, such as for Leaving the node. For this reason, when the
       
   397 	RNodeInterface is created, some memory is allocated so that a leaving activity can't even fail in an out
       
   398 	of memory situation.
       
   399 
       
   400 	This method is static as the memory must be claimed before the activity object is constructed.
       
   401 
       
   402 	@param aNode The node that owns the preallocated space. This must be the node that the activity runs on.
       
   403 	@param aSize Size of buffer to allocate.
       
   404 
       
   405 	@return A pointer to the allocated block of memory
       
   406 	*/
       
   407 	IMPORT_C TAny* ClaimPreallocatedSpace(TUint aSize);
       
   408 
   370 protected:
   409 protected:
   371 	TClientType iClientType;
   410 	TClientType iClientType;
       
   411 private:
       
   412 	struct TPreAllocStore
       
   413 		{
       
   414 		TPreAllocStore()
       
   415 			{
       
   416 			iPreAllocSize=0;
       
   417 			iPreAllocatedActivityChunk=NULL;
       
   418 			}
       
   419 		TUint iPreAllocSize;
       
   420 		TAny* iPreAllocatedActivityChunk;
       
   421 		};
       
   422 
       
   423 	TPreAllocStore* iPreAlloc;
   372 	};
   424 	};
   373 
   425 
   374 class RRequestOriginator
   426 class RRequestOriginator
   375 /*
   427 /*
   376 RRequestOriginator is a helper class that ackowledges the very common scenario
   428 RRequestOriginator is a helper class that ackowledges the very common scenario