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

DC_BasicReconfigurer Class Reference
[General Base Classes]

#include <DC_BasicReconfigurer.h>

Inheritance diagram for DC_BasicReconfigurer:

CC_RootObject List of all members.

Detailed Description

Reconfiguration manager that implements a basic reconfiguration policy independent of any reconfiguration functionality.

This component is useful under the following conditions

This component implements the management of the configurations but it does not make any assumptions about what the configurations represent. A configuration is simply represented by an integer that can take a value in the interval [0, N-1]. The health status is represented by a boolean with the value true representing "healthy".

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.

Author:
Alessandro Pasetti (P&P Software GmbH)
Version:
1.0

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.


Constructor & Destructor Documentation

DC_BasicReconfigurer::DC_BasicReconfigurer void   ) 
 

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.


Member Function Documentation

TD_Config DC_BasicReconfigurer::getActive void   )  const
 

Return the currently active configuration.

Returns:
the currently active configuration

Definition at line 93 of file DC_BasicReconfigurer.cpp.

TD_Config DC_BasicReconfigurer::getNumberOfConfigurations void   )  const
 

Return the number of configurations.

Returns:
the number of configurations

Definition at line 97 of file DC_BasicReconfigurer.cpp.

bool DC_BasicReconfigurer::isConfigurationHealthy TD_Config  i  )  const
 

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.

Parameters:
i the configuration index
Returns:
true if the i-th configuration is healthy, false otherwise

Definition at line 78 of file DC_BasicReconfigurer.cpp.

bool DC_BasicReconfigurer::isEnabled void   )  const
 

Check whether reconfigurations are enabled.

See also:
setEnabled
Returns:
true if reconfigurations are enabled, false otherwise

Definition at line 89 of file DC_BasicReconfigurer.cpp.

bool DC_BasicReconfigurer::isObjectConfigured void   )  [virtual]
 

Perform a class-specific configuration check on a basic reconfigurer: verify that the number of configurations is greater than zero.

Returns:
true if the object is configured, false otherwise

Reimplemented from CC_RootObject.

Definition at line 110 of file DC_BasicReconfigurer.cpp.

void DC_BasicReconfigurer::reconfigure void   )  [virtual]
 

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.

void DC_BasicReconfigurer::setActive TD_Config  activeConfig  ) 
 

Set the active configuration.

After calling this method, the active configuration is guaranteed to be equal to the value of the parameter active. This is the case independently of whether or not reconfiguration are enabled or disabled and irrespective of the health status of the target configuration.

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.

See also:
TD_EventType
Parameters:
activeConfig the new active configuration

Definition at line 25 of file DC_BasicReconfigurer.cpp.

void DC_BasicReconfigurer::setEnabled bool  enabled  ) 
 

Enable/disable all reconfigurations.

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

Definition at line 85 of file DC_BasicReconfigurer.cpp.

void DC_BasicReconfigurer::setHealthStatus TD_Config  i,
bool  healthStatus
 

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.

See also:
TD_EventType
Parameters:
i the configuration index
healthStatus the health status of the i-th configuration

Definition at line 68 of file DC_BasicReconfigurer.cpp.

void DC_BasicReconfigurer::setNumberOfConfigurations TD_Config  nOfConfig  ) 
 

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.

Parameters:
nOfConfig the number of configurations

Definition at line 56 of file DC_BasicReconfigurer.cpp.


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