#include <ModeManager.h>
Inheritance diagram for ModeManager:
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:
setNumberOfModes
setDefaultMode
reset
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. |
|
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. |
|
Allocate the memory for the internal data structures whose size depends on the number of modes.
Implemented in DC_DummyModeManager, PunctualActionListModeManager, DC_PUSTelemetryModeManager, and TelemetryListModeManager. |
|
Return the current operational mode.
Definition at line 16 of file ModeManager_inl.h. |
|
Return the number of operational mode.
Definition at line 33 of file ModeManager_inl.h. |
|
Perform a class-specific configuration check on a mode manager: verify that the number of modes and the default modes have legal values.
Reimplemented from CC_RootObject. Reimplemented in PunctualActionListModeManager, DC_PUSTelemetryModeManager, and TelemetryListModeManager. Definition at line 82 of file ModeManager.cpp. |
|
Check whether transitions to the argument target mode are enabled.
Definition at line 23 of file ModeManager_inl.h. |
|
Check whether mode transitions are enabled.
Definition at line 29 of file ModeManager_inl.h. |
|
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. |
|
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
Definition at line 52 of file ModeManager.cpp. |
|
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 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.
Definition at line 26 of file ModeManager.cpp. |
|
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.
Definition at line 41 of file ModeManager.cpp. |
|
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.
Definition at line 73 of file ModeManager.cpp. |
|
Enable/disable all mode transitions. When mode transitions are disabled, the current operational mode is never changed.
Definition at line 68 of file ModeManager.cpp. |
|
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.
Implemented in DC_CyclingPunctualActionModeManager, DC_DummyModeManager, DC_SimplePunctualActionModeManager, DC_CyclingTelemetryModeManager, DC_PUSTelemetryModeManager, and DC_SimpleTelemetryModeManager. |