MeshMachine::AContextStore Class Reference

class MeshMachine::AContextStore

If an activity has a transition or fork that is blocked by a mutex, the context must be stored so that when the transition or fork is unblocked it would be able to continue with the context that it had before it was blocked. If this aggregate wasn't used in the previous scenario, the context of the event that triggered the unblocking would be used, and this may have the wrong message, or event originator set.

Error recovery is another scenario this class is useful in.

Constructor & Destructor Documentation

AContextStore()

AContextStore()[protected, inline, explicit]

Constructor for AContextStore

~AContextStore()

~AContextStore()[protected, inline]

Destructor for AContextStore

Member Functions Documentation

IsStored()

IMPORT_C TBoolIsStored()const

Check of the context is stored.

LoadContext(AMMNodeBase &, CNodeActivityBase *, TDes8 &, TDes8 &, const Messages::TNodeId &)

IMPORT_C TNodeContextBase *LoadContext(AMMNodeBase &aNode,
CNodeActivityBase *aNodeActivity,
TDes8 &aCtxBuff,
TDes8 &aMsgBuff,
const Messages::TNodeId &aDummy
)[protected]

Load a stored context. Once the stored context has been loaded the status of iContextDesc is undefined and load shouldn't be called again until something has been stored.

The pointer returned uses memory allocated in the aCtxBuff that is passed in, and as such, does not need to be freed. However aCtxBuff and aMsgBuff must be cleaned up after use.

Parameters

AMMNodeBase & aNodeThe node for the context
CNodeActivityBase * aNodeActivityThe activity for the context.
TDes8 & aCtxBuffA memory buffer in which the context will be created.
TDes8 & aMsgBuffA memory buffer in which the message will be created.
const Messages::TNodeId & aDummyWill become the recipient node id in the context.

Retry(CNodeActivityBase &, TNodeContextBase &)

IMPORT_C voidRetry(CNodeActivityBase &aActivity,
TNodeContextBase &aContext
)

Used for error recovery. If the context is stored, loads the stored context and reruns the last transition that was run.

StoreContext LoadContext

Parameters

CNodeActivityBase & aActivityThe activity to retry
TNodeContextBase & aContextThe context within which the retrying is taking place. NOTE: This is not the stored context

RetryingForMessageId()

IMPORT_C const Messages::TNodeSignal::TMessageId &RetryingForMessageId()const

Get the id of the message which requested Retry() AContextStore::Retry

StoreContext(const TNodeContextBase &)

IMPORT_C TIntStoreContext(const TNodeContextBase &aContext)

Store context in buffer. Designed to be called from a transition to store the transitions context for error recovery or to wait on a mutex.

Parameters

const TNodeContextBase & aContextThe context to store

Member Data Documentation

const TInt KInterfaceId

const TIntKInterfaceId[static]

Interface id

RBuf8 iContextDesc

RBuf8 iContextDesc[protected]

Buffer to store the context.

Messages::TNodeSignal::TMessageId iRetryingForMessageId

Messages::TNodeSignal::TMessageId iRetryingForMessageId[protected]

Message id of the message which kicked off the retry attempt