ApparatusFramework::StartupIf Class Reference
[Pattern Services]

#include <PatternServices/current/include/StartupIf.h>

List of all members.

Public Types

enum  Step {
  STEP_0, STEP_1, STEP_2, STEP_3,
  STEP_4, STEP_5, STEP_6, STEP_7,
  STEP_8, STEP_9, STEP_LAST
}

Public Member Functions

 StartupIf ()
virtual ~StartupIf ()
virtual bool initialize (unsigned int step)
virtual bool startup (unsigned int step)
virtual bool shutdown (unsigned int step)
virtual bool cleanup (unsigned int step)
virtual const char * getName ()

Detailed Description

The startup interface defines the startup and shutdown interface for a software component. It is used by the StartupHandler for an orderly start and stop of software components. It is not useful to create direct instances of this class. It is intended to define an interface only. Classes inheriting from this interface are free to implement any of the defined methods. If a method is not overwritten by a subclass, an empty default implementation is provided.

The methods of this class correspond to the four lifecycle phases: initialize, startup, shutdown and cleanup. Plese refer to the method documentation for a closer description of the lifecycle phases. Each phase is further divided into multiple steps (currently 10 steps). This allows detailed control over the sequence in which components are initialized, started, etc. Low level components, such as EEPROM, that are needed by other components during startup, should choose to do their work in an early step. High level components depending on many others should initialize and start up last.

The StartupHandler first calles initialize(STEP_0) for all registered components, then initialize(STEP_1) and so on. A component is responsible by itself to do the correct work in the correct step.

The shutdown and cleanup methods are provided for completeness. It is perfectly acceptable for an apparatus software to ignore these methods. Many devices are not explicitely shut down but merely switched off.

Definition at line 90 of file StartupIf.h.


Member Enumeration Documentation

Defines the step within inlitialize, startup, etc. Useful to have components initialize in a certain order.

Enumerator:
STEP_0 
STEP_1 
STEP_2 
STEP_3 
STEP_4 
STEP_5 
STEP_6 
STEP_7 
STEP_8 
STEP_9 
STEP_LAST 

Definition at line 105 of file StartupIf.h.


Constructor & Destructor Documentation

ApparatusFramework::StartupIf::StartupIf (  ) 

Construction, Destruction Empty constructor.

virtual ApparatusFramework::StartupIf::~StartupIf (  )  [virtual]

Empty destructor.


Member Function Documentation

virtual bool ApparatusFramework::StartupIf::cleanup ( unsigned int  step  )  [virtual]

Is the inverse of initialize: internal connections are removed and the component cleans up after itself. This function is seldom used.

Parameters:
step The current step of cleanup.
Returns:
true if all components are successfully cleaned up, otherwise false. The whole startup process aborts if a component cannot be cleaned up.
virtual const char* ApparatusFramework::StartupIf::getName (  )  [virtual]

Diagnostics Used only for diagnostic purposes to get the name of a component. The default implementation returns "unknown".

Returns:
Name of the component, or "unknown" if no method is provided by subclass.
virtual bool ApparatusFramework::StartupIf::initialize ( unsigned int  step  )  [virtual]

Startup Pattern During initialization, components usually establish connections within the software. E.g. they attach themself as observer to other components. Queries might be done but no actions should be requested. Inputs should remain disabled.

Parameters:
step The current step of initialization.
Returns:
true if all components are successfully initialized, otherwise false. The whole startup process aborts if a component cannot be initialized.
virtual bool ApparatusFramework::StartupIf::shutdown ( unsigned int  step  )  [virtual]

Is the inverse of startup: Communication to peripheral hardware is closed, inputs are disabled and the components witch into disabled mode. After shutdown, a component can be made operational again by calling startup.

Parameters:
step The current step of shutdown.
Returns:
true if all components are successfully shut down, otherwise false. The whole startup process aborts if a component cannot be shut down.
virtual bool ApparatusFramework::StartupIf::startup ( unsigned int  step  )  [virtual]

During startup, communication to peripheral hardware is established. The components switch to operational mode. Inputs are enabled.

Parameters:
step The current step of startup.
Returns:
true if all components are successfully started up, otherwise false. The whole startup process aborts if a component cannot be started up.
© 2004-2010 bbv Software Services AG / Apparatus Services