Main Page | Modules | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages

ModeManager Class Reference
[General Base ClassesMode Management]

#include <ModeManager.h>

Inheritance diagram for ModeManager:

CC_RootObject DC_DummyModeManager PunctualActionModeManager TelemetryModeManager PunctualActionListModeManager DC_PUSTelemetryModeManager TelemetryListModeManager DC_CyclingPunctualActionModeManager DC_SimplePunctualActionModeManager DC_CyclingTelemetryModeManager DC_SimpleTelemetryModeManager List of all members.

Detailed Description

Base class from which all classes encapsulating mode managers are derived.

Conceptually, a mode manager is characterized by:<ul> A set of operational modes of which, at any given time, one and only one is the current operational mode, A set of strategies, For each strategy, a set of implementations of which, at any given time, one and only one is the current implementation, and An update mechanism for controlling the change in the current operational mode. This is an abstract class because it only defines the management of the operational mode. All other aspects listed above are defined and/or implemented by subclasses.

Changes in operational mode are recorded through an event report. It is possible to selectively disable transitions to certain operational modes or to disable all mode transitions.

An initialization sequence for this class consists of the following steps:

The above operations must be performed in the order given.
Author:
Alessandro Pasetti (P&P Software GmbH)
Version:
1.0

Definition at line 51 of file ModeManager.h.

Public Member Functions

 ModeManager (void)
 Instantiate a mode manager.

virtual void update (void)=0
 Execute the update operation for the mode manager.

void setNumberOfModes (TD_Mode numberOfModes)
 Set the number of modes of the mode manager.

void setDefaultMode (TD_Mode defaultMode)
 Set the default mode of the mode manager.

void setTransitionEnableStatus (bool enabled)
 Enable/disable all mode transitions.

void setTransitionEnableStatus (TD_Mode toMode, bool enabled)
 Enable/disable transitions to the toMode-th operational mode.

bool isTransitionEnabled (void) const
 Check whether mode transitions are enabled.

bool isTransitionEnabled (TD_Mode toMode) const
 Check whether transitions to the argument target mode are enabled.

TD_Mode getCurrentMode (void) const
 Return the current operational mode.

TD_Mode getNumberOfModes (void) const
 Return the number of operational mode.

virtual void reset (void)
 Enable all mode transitions and set the operational mode to the default mode.

virtual bool isObjectConfigured (void)
 Perform a class-specific configuration check on a mode manager: verify that the number of modes and the default modes have legal values.


Protected Member Functions

void setMode (TD_Mode newMode)
 Change the operational mode the mode manager.

virtual void allocateMemory (TD_Mode numberOfModes)=0
 Allocate the memory for the internal data structures whose size depends on the number of modes.


Constructor & Destructor Documentation

ModeManager::ModeManager void   ) 
 

Instantiate a mode manager.

The number of modes, the current mode, and the default mode are set to illegal values to signify that the component is not yet initialized.

Definition at line 18 of file ModeManager.cpp.


Member Function Documentation

virtual void ModeManager::allocateMemory TD_Mode  numberOfModes  )  [protected, pure virtual]
 

Allocate the memory for the internal data structures whose size depends on the number of modes.

See also:
setNumberOfModes
Parameters:
numberOfModes the number of modes

Implemented in DC_DummyModeManager, PunctualActionListModeManager, DC_PUSTelemetryModeManager, and TelemetryListModeManager.

TD_Mode ModeManager::getCurrentMode void   )  const [inline]
 

Return the current operational mode.

Returns:
the current mode

Definition at line 16 of file ModeManager_inl.h.

TD_Mode ModeManager::getNumberOfModes void   )  const [inline]
 

Return the number of operational mode.

Returns:
the number of operational modes

Definition at line 33 of file ModeManager_inl.h.

bool ModeManager::isObjectConfigured void   )  [virtual]
 

Perform a class-specific configuration check on a mode manager: verify that the number of modes and the default modes have legal values.

Returns:
true if the object is configured, false otherwise

Reimplemented from CC_RootObject.

Reimplemented in PunctualActionListModeManager, DC_PUSTelemetryModeManager, and TelemetryListModeManager.

Definition at line 82 of file ModeManager.cpp.

bool ModeManager::isTransitionEnabled TD_Mode  toMode  )  const [inline]
 

Check whether transitions to the argument target mode are enabled.

See also:
setTransitionEnableStatus
Parameters:
toMode the target mode
Returns:
true if a transition into the target mode is enabled

Definition at line 23 of file ModeManager_inl.h.

bool ModeManager::isTransitionEnabled void   )  const [inline]
 

Check whether mode transitions are enabled.

See also:
setTransitionEnableStatus
Returns:
true if mode transitions are enabled, false otherwise

Definition at line 29 of file ModeManager_inl.h.

void ModeManager::reset void   )  [virtual]
 

Enable all mode transitions and set the operational mode to the default mode.

This method is declared virtual so as to allow concrete mode managers to define more specific reset operations.

Definition at line 60 of file ModeManager.cpp.

void ModeManager::setDefaultMode TD_Mode  defaultMode  ) 
 

Set the default mode of the mode manager.

The default mode of the mode manager is its operational mode at the end of the configuration process or after a call to method rest. The default mode argument must lie in the interval [0,N-1] where N is the total number of modes. If an illegal default mode is used, then the method generates an event report of type EVT_ILLEGAL_MM and returns without taking any action.

Parameters:
defaultMode the default mode

Definition at line 52 of file ModeManager.cpp.

void ModeManager::setMode TD_Mode  newMode  )  [protected]
 

Change the operational mode the mode manager.

This method is responsible for managing the event reporting mechanism and the mode transition inhibition mechanism. All mode changes should occurr through this method. This in particular applies to changes commanded by implementations of method update in derived classes. A pseudo-code implementation for this method is as follows:

   if (newMode != currentMode)
      if (isTransitionEnabled() && isTransitionEnabled(newMode))
        currentMode = newMode;
        createEventReport(EVT_MOD_TRANS_PERFORMED);
      else
        createEventReport(EVT_MOD_TRANS_INHIBITED);
where currentMode is the operational mode at the time the method is called and instanceId is the instance identifier of the mode manager component.
See also:
update

TD_EventType

CC_RootObject

Parameters:
newMode the new operational mode

Definition at line 26 of file ModeManager.cpp.

void ModeManager::setNumberOfModes TD_Mode  numberOfModes  ) 
 

Set the number of modes of the mode manager.

This is an initialization method. It should only be called once. Successive calls have no effect. The number of modes should be greater than zero.

A pseudo-code implementation for this method is as follows:

      . . .    // allocate memory for internal data structures
      allocateMemory(numberOfModes); 
Concrete mode managers will normally use some internal data structure to hold mode-related information. The memory for this data structure must be allocated when the component is initialized. The call to the protected and abstract method allocateMemory can be used for this purpose.

This is an initialization method. It should be called only once. Only positive number of modes are legal.

See also:
allocateMemory
Parameters:
numberOfModes the number of modes

Definition at line 41 of file ModeManager.cpp.

void ModeManager::setTransitionEnableStatus TD_Mode  toMode,
bool  enabled
 

Enable/disable transitions to the toMode-th operational mode.

The toMode argument must lie in the interval [0,N-1] where N is the total number of modes. If an illegal default mode is used, then the method generates an event report of type EVT_ILLEGAL_MM and returns without taking any action.

See also:
update
Parameters:
toMode the operational mode to which transitions are enabled/disabled
enabled the transition is disabled if false, enabled if true

Definition at line 73 of file ModeManager.cpp.

void ModeManager::setTransitionEnableStatus bool  enabled  ) 
 

Enable/disable all mode transitions.

When mode transitions are disabled, the current operational mode is never changed.

See also:
update
Parameters:
enabled the transition are disabled if false, enabled if true

Definition at line 68 of file ModeManager.cpp.

virtual void ModeManager::update void   )  [pure virtual]
 

Execute the update operation for the mode manager.

This method is declared abstract because the update mechanism is application-specific and must be defined by concrete subclasses. A pseudo-code implementation for a typical implementation of this method takes the following form:

   newMode = . . .    // compute new operational mode;
   setMode(newMode);
Thus, the method computes the new mode and then uses the setMode method to attempt a mode update. Note that it is this latter method that is responsible for enforcing the mode transition inhibitions and for reporting mode changes as events.

This method implements the update basic operation of mode managers.

See also:
setMode

Implemented in DC_CyclingPunctualActionModeManager, DC_DummyModeManager, DC_SimplePunctualActionModeManager, DC_CyclingTelemetryModeManager, DC_PUSTelemetryModeManager, and DC_SimpleTelemetryModeManager.


The documentation for this class was generated from the following files:
Copyright 2003 P&P Software GmbH - All Rights Reserved