#include <DC_BasicReconfigurer.h>
Inheritance diagram for DC_BasicReconfigurer:
This component is useful under the following conditions
Reconfigurations (i.e. changes in the active configuration) are recorded through an event report.
It is possible to force the healthy/unhealthy state of a configuration and it is possible to enable/disable reconfigurations.
This class can be used as the base class for reconfiguration managers that are responsible for managing reconfigurations across concrete implementations of a specific functionality. Or it can be used as a "helper class" for such a concrete reconfiguration manager.
Method reconfigure
is implemented as a virtual method to allow easy implementations of alternative reconfiguration policies.
Some of the methods defined by the class take as a parameter an integer index i that designates a configuration. Run-time checks on the legality of the index are only performed where errors might corrupt internal data structures (typically, during write accesses). In other cases, responsibility for ensuring the legality of the index is left to the caller.
Definition at line 65 of file DC_BasicReconfigurer.h.
Public Member Functions | |
DC_BasicReconfigurer (void) | |
Instantiate a basic reconfigurer. | |
virtual void | reconfigure (void) |
Perform a reconfiguration. | |
void | setNumberOfConfigurations (TD_Config nOfConfig) |
Set the number of configurations controlled by this reconfiguration manager. | |
void | setHealthStatus (TD_Config i, bool healthStatus) |
Set the health status of the i-th configuration. | |
bool | isConfigurationHealthy (TD_Config i) const |
Return the health status of the i-th configuration. | |
void | setActive (TD_Config activeConfig) |
Set the active configuration. | |
void | setEnabled (bool enabled) |
Enable/disable all reconfigurations. | |
bool | isEnabled (void) const |
Check whether reconfigurations are enabled. | |
TD_Config | getActive (void) const |
Return the currently active configuration. | |
TD_Config | getNumberOfConfigurations (void) const |
Return the number of configurations. | |
void | reset (void) |
Enable all reconfigurations, set all configuration status to "healthy", set the active configuration equal to configuration 0. | |
virtual bool | isObjectConfigured (void) |
Perform a class-specific configuration check on a basic reconfigurer: verify that the number of configurations is greater than zero. |
|
Instantiate a basic reconfigurer. The number of configurations is initialized to an illegal value to signify that the component is not yet configured. Reconfigurations are enabled by default. The class identifier is set. Definition at line 17 of file DC_BasicReconfigurer.cpp. |
|
Return the currently active configuration.
Definition at line 93 of file DC_BasicReconfigurer.cpp. |
|
Return the number of configurations.
Definition at line 97 of file DC_BasicReconfigurer.cpp. |
|
Return the health status of the i-th configuration. The parameter i must be in the range [0,N-1] where N is the total number of configurations but no check is performed on the legality of i.
Definition at line 78 of file DC_BasicReconfigurer.cpp. |
|
Check whether reconfigurations are enabled.
Definition at line 89 of file DC_BasicReconfigurer.cpp. |
|
Perform a class-specific configuration check on a basic reconfigurer: verify that the number of configurations is greater than zero.
Reimplemented from CC_RootObject. Definition at line 110 of file DC_BasicReconfigurer.cpp. |
|
Perform a reconfiguration. If reconfigurations are enabled, then one of the non-active but healthy configurations is made active and the originally active configuration is marked "unhealthy". If there are no available healthy configurations, nothing is done beyond reporting the fact as an event. If reconfigurations are disabled, nothing is done beyond reporting the fact as an event. A pseudo-code implementation for this method is as follows: if ( reconfigurations are enabled) { // compute new operational mode; if ( there is a healthy non-active configuration H ) { temp = activeConfiguration activeConfiguration = H; createEventReport(EVT_RECONFIG); setHealthStatus(temp,UNHEALTHY); } else createEventReport(EVT_RECONFIG_NO_HEALTHY) } else createEventReport(EVT_RECONFIG_DISABLED);The classId in the above code that is used as an event parameter is the class identifier of the reconfigurer.
Definition at line 37 of file DC_BasicReconfigurer.cpp. |
|
Set the active configuration.
After calling this method, the active configuration is guaranteed to be equal to the value of the parameter Note that forcing the active configuration will often be equivalent to performing a reconfiguration (if the original active configuration is different from the target configuration specified by this method). If this is the case, then an event report of type EVT_RECONFIG is generated. Note also that no check is performed upon the health status of the target configuration specified by this method. Execution of this method may thus result in an unhealthy configuration being the active configuration. The parameter i must be in the range [0,N-1] where N is the total number of configurations. A check is performed to verify that the value of i is legal. If it is not, event EVT_ILLEGAL_CONFIG is generated.
Definition at line 25 of file DC_BasicReconfigurer.cpp. |
|
Enable/disable all reconfigurations.
Definition at line 85 of file DC_BasicReconfigurer.cpp. |
|
Set the health status of the i-th configuration. The parameter i must be in the range [0,N-1] where N is the total number of configurations. A check is performed to verify that the value of i is legal. If it is not, event EVT_ILLEGAL_CONFIG is generated.
Definition at line 68 of file DC_BasicReconfigurer.cpp. |
|
Set the number of configurations controlled by this reconfiguration manager. This is an initialization method. It should only be called once. The number of configurations must be greater than zero. A call to this method causes the component to allocate the memory it needs for its internal data structures. All configurations are initialized to "healthy" and the configuration with index zero is designated as the active configuration.
Definition at line 56 of file DC_BasicReconfigurer.cpp. |