commsfwsupport/commselements/meshmachine/inc/mm_activities.h
changeset 30 df67dc5d759e
parent 0 dfb7c4ff071f
child 32 d2396c80c344
equal deleted inserted replaced
25:e53adc4c49de 30:df67dc5d759e
    89 @see DEFINE_CUSTOM_NODEACTIVITY
    89 @see DEFINE_CUSTOM_NODEACTIVITY
    90 */
    90 */
    91 	#define DEFINE_EXPORT_CUSTOM_NODEACTIVITY( id, name, msgtype, ctor ) \
    91 	#define DEFINE_EXPORT_CUSTOM_NODEACTIVITY( id, name, msgtype, ctor ) \
    92 		EXPORT_C const MeshMachine::TNodeActivity& name :: Self() {return iSelf;} \
    92 		EXPORT_C const MeshMachine::TNodeActivity& name :: Self() {return iSelf;} \
    93 		EXPORT_C const NetStateMachine::TStateTriple& name :: FirstTriple() {return iData[1];} \
    93 		EXPORT_C const NetStateMachine::TStateTriple& name :: FirstTriple() {return iData[1];} \
    94 		const MeshMachine::TNodeActivity name :: iSelf = {id, msgtype::EId, msgtype::ERealm, name :: iData[1], &ctor, _S8(#name)}; \
    94 		const MeshMachine::TNodeActivity name :: iSelf = {id, 0, msgtype::EId, msgtype::ERealm, name :: iData[1], (TAny*)&ctor, _S8(#name)}; \
    95 		DEFINE_TRIPLES_TABLE( name :: iData )
    95 		DEFINE_TRIPLES_TABLE( name :: iData )
    96 
    96 
    97 /**
    97 /**
    98 Define a custom node activity. A custom node activity is a node activity which defines its own
    98 Define a custom node activity. A custom node activity is a node activity which defines its own
    99 node activity class. This is used, for example, if the activity wishes to share some custom context
    99 node activity class. This is used, for example, if the activity wishes to share some custom context
   108 
   108 
   109 @see DEFINE_NODEACTIVITY
   109 @see DEFINE_NODEACTIVITY
   110 @see CNodeActivityBase
   110 @see CNodeActivityBase
   111 */
   111 */
   112 	#define DEFINE_CUSTOM_NODEACTIVITY( id, name, msgtype, ctor ) \
   112 	#define DEFINE_CUSTOM_NODEACTIVITY( id, name, msgtype, ctor ) \
   113 		const MeshMachine::TNodeActivity name :: iSelf = {id, msgtype::EId, msgtype::ERealm, name :: iData[1], &ctor, _S8(#name)}; \
   113 		const MeshMachine::TNodeActivity name :: iSelf = {id, 0, msgtype::EId, msgtype::ERealm, name :: iData[1], (TAny*)&ctor, _S8(#name)}; \
   114 		DEFINE_TRIPLES_TABLE( name :: iData )
   114 		DEFINE_TRIPLES_TABLE( name :: iData )
   115 
   115 
   116 #else
   116 #else
   117 
   117 
   118 /**
   118 /**
   126 @see DEFINE_CUSTOM_NODEACTIVITY
   126 @see DEFINE_CUSTOM_NODEACTIVITY
   127 */
   127 */
   128 	#define DEFINE_EXPORT_CUSTOM_NODEACTIVITY( id, name, msgtype, ctor ) \
   128 	#define DEFINE_EXPORT_CUSTOM_NODEACTIVITY( id, name, msgtype, ctor ) \
   129 		EXPORT_C const MeshMachine::TNodeActivity& name :: Self() {return iSelf;} \
   129 		EXPORT_C const MeshMachine::TNodeActivity& name :: Self() {return iSelf;} \
   130 		EXPORT_C const NetStateMachine::TStateTriple& name :: FirstTriple() {return iData[1];} \
   130 		EXPORT_C const NetStateMachine::TStateTriple& name :: FirstTriple() {return iData[1];} \
   131 		const MeshMachine::TNodeActivity name :: iSelf = {id, msgtype::EId, msgtype::ERealm, name :: iData[1], &ctor, NULL}; \
   131 		const MeshMachine::TNodeActivity name :: iSelf = {id, 0, msgtype::EId, msgtype::ERealm, name :: iData[1], (TAny*)&ctor, NULL}; \
   132 		DEFINE_TRIPLES_TABLE( name :: iData )
   132 		DEFINE_TRIPLES_TABLE( name :: iData )
   133 
   133 
   134 /**
   134 /**
   135 Define a custom node activity. A custom node activity is a node activity which defines its own
   135 Define a custom node activity. A custom node activity is a node activity which defines its own
   136 node activity class. This is used, for example, if the activity wishes to share some custom context
   136 node activity class. This is used, for example, if the activity wishes to share some custom context
   145 
   145 
   146 @see DEFINE_NODEACTIVITY
   146 @see DEFINE_NODEACTIVITY
   147 @see CNodeActivityBase
   147 @see CNodeActivityBase
   148 */
   148 */
   149 	#define DEFINE_CUSTOM_NODEACTIVITY( id, name, msgtype, ctor ) \
   149 	#define DEFINE_CUSTOM_NODEACTIVITY( id, name, msgtype, ctor ) \
   150 		const MeshMachine::TNodeActivity name :: iSelf = {id, msgtype::EId, msgtype::ERealm, name :: iData[1], &ctor, NULL}; \
   150 		const MeshMachine::TNodeActivity name :: iSelf = {id, 0, msgtype::EId, msgtype::ERealm, name :: iData[1], (TAny*)&ctor, NULL}; \
   151 		DEFINE_TRIPLES_TABLE( name :: iData )
   151 		DEFINE_TRIPLES_TABLE( name :: iData )
   152 
   152 
   153 #endif
   153 #endif
   154 
   154 
   155 /**
   155 /**
   415 	NULL, \
   415 	NULL, \
   416 	NULL \
   416 	NULL \
   417 	};
   417 	};
   418 
   418 
   419 /**
   419 /**
       
   420 RESERVED MACROS NOT TO BE USED.
       
   421 The following are new macro definitions allowing the context to be passed as a parameter rather than the node.
       
   422 In time the ability to pass context rather than node will be placed in the original macros. For the meantime,
       
   423 only critical commsFw activities which must have the context passed instead of the node should use these macros.
       
   424 All other activities should continue to use original macros declared above.
       
   425 */
       
   426 /**
       
   427 Declare and export a node activity.
       
   428 
       
   429 @param name  The name of the activity, which will be used to put it into the node's activity map
       
   430 
       
   431 @see DECLARE_NODEACTIVITY
       
   432 */
       
   433 #define DECLARE_RESERVED_EXPORT_NODEACTIVITY( name ) \
       
   434 	struct name \
       
   435 		{ \
       
   436 		IMPORT_C static const MeshMachine::TNodeActivity& Self(); \
       
   437 		IMPORT_C static const NetStateMachine::TStateTriple& FirstTriple(); \
       
   438 		static const MeshMachine::TNodeActivity iSelf; \
       
   439 		static const NetStateMachine::TStateTriple iData[]; \
       
   440 		};
       
   441 
       
   442 /**
       
   443 Declares a node activity. A node activity is a state machine. It contains multiple nodeactivity
       
   444 entries, which respresent the states, transitions and forks of the state machine.
       
   445 
       
   446 @param name  The name of the activity, which will be used to put it into the node's activity map
       
   447 
       
   448 @see DEFINE_NODEACTIVITY
       
   449 @see NODEACTIVITY_ENTRY
       
   450 */
       
   451 #define DECLARE_RESERVED_NODEACTIVITY( name ) \
       
   452 	struct name \
       
   453 		{ \
       
   454 		inline static const MeshMachine::TNodeActivity& Self() {return iSelf;} \
       
   455 		inline static const NetStateMachine::TStateTriple& FirstTriple() {return iData[1];} \
       
   456 		static const MeshMachine::TNodeActivity iSelf; \
       
   457 		static const NetStateMachine::TStateTriple iData[]; \
       
   458 		};
       
   459 
       
   460 #ifdef SYMBIAN_TRACE_ENABLE
       
   461 
       
   462 /**
       
   463 Define a custom node activity. A custom node activity is a node activity which defines its own
       
   464 node activity class. This is used, for example, if the activity wishes to share some custom context
       
   465 information between the states and transition in the activity.
       
   466 
       
   467 Node activity class must derive from CNodeActivityBase.
       
   468 
       
   469 @param id        Identifier for the activity
       
   470 @param name      The name of the activity
       
   471 @param msgtype   Message which will kickoff this activity
       
   472 @param ctor      Constructor for the custom activity class
       
   473 
       
   474 @see DEFINE_RESERVED_NODEACTIVITY
       
   475 @see CNodeActivityBase
       
   476 	
       
   477 */
       
   478 	#define DEFINE_RESERVED_CUSTOM_NODEACTIVITY( id, name, msgtype, ctor ) \
       
   479 		const MeshMachine::TNodeActivity name :: iSelf = {id, 1, msgtype::EId, msgtype::ERealm, name :: iData[1], (TAny*)&ctor, _S8(#name)}; \
       
   480 		DEFINE_TRIPLES_TABLE( name :: iData )
       
   481 
       
   482 #else
       
   483 
       
   484 /**
       
   485 Define and export a custom node activity.
       
   486 
       
   487 @param id        Identifier for the activity
       
   488 @param name      The name of the activity
       
   489 @param msgtype   Message which will kickoff this activity
       
   490 @param ctor      Constructor for the custom activity class
       
   491 
       
   492 @see DEFINE_RESERVED_CUSTOM_NODEACTIVITY
       
   493 */
       
   494 	#define DEFINE_RESERVED_EXPORT_CUSTOM_NODEACTIVITY( id, name, msgtype, ctor ) \
       
   495 		EXPORT_C const MeshMachine::TNodeActivity& name :: Self() {return iSelf;} \
       
   496 		EXPORT_C const NetStateMachine::TStateTriple& name :: FirstTriple() {return iData[1];} \
       
   497 		const MeshMachine::TNodeActivity name :: iSelf = {id, 1, msgtype::EId, msgtype::ERealm, name :: iData[1], (TAny*)&ctor, NULL}; \
       
   498 		DEFINE_TRIPLES_TABLE( name :: iData )
       
   499 
       
   500 /**
       
   501 Define a custom node activity. A custom node activity is a node activity which defines its own
       
   502 node activity class. This is used, for example, if the activity wishes to share some custom context
       
   503 information between the states and transition in the activity.
       
   504 
       
   505 Node activity class must derive from CNodeActivityBase.
       
   506 
       
   507 @param id        Identifier for the activity
       
   508 @param name      The name of the activity
       
   509 @param msgtype   Message which will kickoff this activity
       
   510 @param ctor      Constructor for the custom activity class
       
   511 
       
   512 @see DEFINE_RESERVED_NODEACTIVITY
       
   513 @see CNodeActivityBase
       
   514 */
       
   515 	#define DEFINE_RESERVED_CUSTOM_NODEACTIVITY( id, name, msgtype, ctor ) \
       
   516 		const MeshMachine::TNodeActivity name :: iSelf = {id, 1, msgtype::EId, msgtype::ERealm, name :: iData[1], (TAny*)&ctor, NULL}; \
       
   517 		DEFINE_TRIPLES_TABLE( name :: iData )
       
   518 
       
   519 #endif
       
   520 
       
   521 /**
       
   522 Define and declare a custom node activity
       
   523 
       
   524 @param id        Identifier for the activity
       
   525 @param name      The name of the activity
       
   526 @param msgtype   Message which will kickoff this activity
       
   527 @param ctor      Constructor for the custom activity class
       
   528 
       
   529 @see DEFINE_RESERVED_CUSTOM_NODEACTIVITY
       
   530 */
       
   531 #define DECLARE_DEFINE_RESERVED_CUSTOM_NODEACTIVITY( id, name, msgtype, ctor ) \
       
   532 	DECLARE_RESERVED_NODEACTIVITY( name ) \
       
   533 	DEFINE_RESERVED_CUSTOM_NODEACTIVITY( id, name, msgtype, ctor )
       
   534 
       
   535 /**
       
   536 END OF RESERVED MACROS
       
   537 */
       
   538 
       
   539 /**
   420 Mark the end of an activity map. This macro should be used for an activity map based
   540 Mark the end of an activity map. This macro should be used for an activity map based
   421 on other activity maps.
   541 on other activity maps.
   422 
   542 
   423 @param name_space The namespace of the base map
   543 @param name_space The namespace of the base map
   424 @param base_map   The name of the base map
   544 @param base_map   The name of the base map
   430 	(MeshMachine::TNodeActivityMap::TStaticNodeActivity)&name_space::base_map::Self \
   550 	(MeshMachine::TNodeActivityMap::TStaticNodeActivity)&name_space::base_map::Self \
   431 	};
   551 	};
   432 
   552 
   433 namespace MeshMachine
   553 namespace MeshMachine
   434 {
   554 {
       
   555 
   435 /**
   556 /**
   436 Base class for all node activity objects. Non custom node activities will use this by default.
   557 Base class for all node activity objects. Non custom node activities will use this by default.
   437 **/
   558 **/
   438 class CNodeActivityBase : public CBase,
   559 class CNodeActivityBase : public CBase,
   439                           public NetInterfaces::AApiExtBase,
   560                           public NetInterfaces::AApiExtBase,
   844 	For use by custom activity NewLs to generate the unique part of the activity id.
   965 	For use by custom activity NewLs to generate the unique part of the activity id.
   845 	@param aActivitySig Context information about how the activity is to be started
   966 	@param aActivitySig Context information about how the activity is to be started
   846 	@param aNode        The node to which this activity will belong.
   967 	@param aNode        The node to which this activity will belong.
   847 	@return Generated unique component of activity id
   968 	@return Generated unique component of activity id
   848 	*/
   969 	*/
   849 	IMPORT_C static TUint GetNextActivityCountL( const TNodeActivity& aActivitySig, const AMMNodeBase& aNode );
   970 	static TUint GetNextActivityCountL( const TNodeActivity& aActivitySig, const AMMNodeBase& aNode );
       
   971 	/**
       
   972 	For use by custom activity News to generate the unique part of the activity id.
       
   973 	@param aActivitySig Context information about how the activity is to be started
       
   974 	@param aNode        The node to which this activity will belong.
       
   975 	@return Generated unique component of activity id
       
   976 	*/
       
   977 	IMPORT_C static TUint GetNextActivityCount( const TNodeActivity& aActivitySig, const AMMNodeBase& aNode );
   850 
   978 
   851 	/**
   979 	/**
   852 	Constructor for CNodeParallelActivityBase
   980 	Constructor for CNodeParallelActivityBase
   853 	@param aActivitySig Context information about how the activity is to be started
   981 	@param aActivitySig Context information about how the activity is to be started
   854 	@param aNode        The node to which this activity will belong.
   982 	@param aNode        The node to which this activity will belong.
  1385 	Private NewL with no implementation to hide the CNodeActivityBase::NewL
  1513 	Private NewL with no implementation to hide the CNodeActivityBase::NewL
  1386 	Creation of preallocated activities doesn't fail and hence a non-leaving ::New should be used instead*/
  1514 	Creation of preallocated activities doesn't fail and hence a non-leaving ::New should be used instead*/
  1387     static MeshMachine::CNodeActivityBase* NewL(const MeshMachine::TNodeActivity& aActivitySig, MeshMachine::AMMNodeBase& aNode);
  1515     static MeshMachine::CNodeActivityBase* NewL(const MeshMachine::TNodeActivity& aActivitySig, MeshMachine::AMMNodeBase& aNode);
  1388 	};
  1516 	};
  1389 
  1517 
       
  1518 
       
  1519 inline TUint CNodeParallelActivityBase::GetNextActivityCountL( const TNodeActivity& aActivitySig, const AMMNodeBase& aNode )
       
  1520     {
       
  1521     //Historical. Method ceased to leave, but must keep the old, L-ending overload.
       
  1522     return GetNextActivityCount(aActivitySig, aNode);
       
  1523     }
       
  1524 
  1390 } //namespace MeshMachine
  1525 } //namespace MeshMachine
  1391 
  1526 
  1392 #endif //SYMBIAN_MM_ACTIVITIES_H
  1527 #endif //SYMBIAN_MM_ACTIVITIES_H
  1393 
  1528