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

PunctualActionListModeManager Class Reference
[General Base ClassesMode Management]

#include <PunctualActionListModeManager.h>

Inheritance diagram for PunctualActionListModeManager:

PunctualActionModeManager ModeManager CC_RootObject DC_CyclingPunctualActionModeManager DC_SimplePunctualActionModeManager List of all members.

Detailed Description

Base abstract class for list-based punctual action mode managers.

A list-based punctual action mode manager handles the set of punctual action in a punctual action mode manager as a statically defined linear list. The mode manager maintains several such lists, one for each operational mode.

At any given time, one list is the current list (or active list). The iteration methods specified in the super class are implemented to iterate over the items in the list starting with the one with the lowest position and ending with the one with the highest position in the list.

The lists are loaded, one item at a time, when the mode manager is configured. The loading methods are: loadListLength (to load the number items in each list) and loadItem (to load the individual items in each list).

This class is abstract because it does not define the update mechanism for the mode manager. This must be defined by concrete subclasses. An initialization sequence for this class consists of the following steps (to be performed in the order given):

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

Definition at line 56 of file PunctualActionListModeManager.h.

Public Member Functions

virtual PunctualActiongetIterationPunctualAction (void)
 Retrieve the punctual action currently scanned by the iteration counter.

void setListItem (unsigned int n, unsigned int pos, PunctualAction *pItem)
 Load an item in a list.

 PunctualActionListModeManager (void)
 Instantiate a punctual action mode manager component.

void setListLength (unsigned int n, unsigned int length)
 Set the size of the n-th list.

virtual void first (void)
 Iteration method to iterate through the punctual actions in the current list.

virtual void next (void)
 Iteration method to be used in conjunction with methods first and isIterationFinished.

virtual bool isIterationFinished (void)
 Iteration method to be used in conjunction with methods first and next.

virtual bool isObjectConfigured (void)
 Perform a class-specific configuration check on a punctual action mode manager: verify that all the lists have been initialized and that all the items have been loaded.


Protected Member Functions

virtual void allocateMemory (TD_Mode numberOfModes)
 Allocate the memory for the lists.


Constructor & Destructor Documentation

PunctualActionListModeManager::PunctualActionListModeManager void   ) 
 

Instantiate a punctual action mode manager component.

The internal data variables are initialized to illegal values to signify that the component is not yet configured.

Definition at line 18 of file PunctualActionListModeManager.cpp.


Member Function Documentation

void PunctualActionListModeManager::allocateMemory TD_Mode  numberOfModes  )  [protected, virtual]
 

Allocate the memory for the lists.

The newly allocated memory is initialized with pNULL. Note that this method cannot allocate all the memory required by a list mode manager because this also depends on the number of items in each list. This number is loaded with method: setLength.

This method is called by method setNumberOfModes in the superclass ModeManager.

This is an initialization method. It should only be called once. The number of modes should be greater than zero.

See also:
ModeManager::setNumberOfModes
Parameters:
numberOfModes the number of modes

Implements ModeManager.

Definition at line 25 of file PunctualActionListModeManager.cpp.

void PunctualActionListModeManager::first void   )  [virtual]
 

Iteration method to iterate through the punctual actions in the current list.

This method should be used jointly with methods: next, isIterationFinished and getPunctualAction. Taken together, these methods allow all the items in a list to be scanned. The list that is thus iterated through is called the iteration list. The iteration list is the current list at the time method first is called. This list is guaranteed to remain unchanged in between successive calls to method first. Thus, even if the current mode changes during the iteration (for instance, following a call to method update), the iterators will continue processing the list that was active when first was called.

This class internally maintains an iteration counter. During an iteration cycle, the iteration counter is incremented from zero to (N-1) where N is number of items in the iteration list. Method first resets the iteration counter to 0. A call to method next causes the iteration counter to be incremented by 1 up to the value of (N-1). Method isIterationFinished returns true when the counter has reached the value (N-1). The item currently pointed at by the iteration counter can be retrieved through method getPunctualAction.

Thus, a typical iteration cycle might be organized as follows:

      for (first(); !isIterationFinished(); next()) {
          pItem = getIterationPunctualAction();
          . . .    // process pItem
      }  

Implements PunctualActionModeManager.

Definition at line 63 of file PunctualActionListModeManager.cpp.

PunctualAction * PunctualActionListModeManager::getIterationPunctualAction void   )  [virtual]
 

Retrieve the punctual action currently scanned by the iteration counter.

This method returns the counter-th item in the iteration list where "counter" is the iteration counter. This method should only be used within an iteration cycle. However, it is guaranteed to return a reference to a list item at all times.

See also:
first
Returns:
the item currently scanned by the iteration counter

Implements PunctualActionModeManager.

Definition at line 79 of file PunctualActionListModeManager.cpp.

bool PunctualActionListModeManager::isIterationFinished void   )  [virtual]
 

Iteration method to be used in conjunction with methods first and next.

This method should only be used as part of an iteration cycle. The result of calling it before ever calling first is undefined.

See also:
first
Returns:
true if the end of the iteration has been reached, false otherwise

Implements PunctualActionModeManager.

Definition at line 74 of file PunctualActionListModeManager.cpp.

bool PunctualActionListModeManager::isObjectConfigured void   )  [virtual]
 

Perform a class-specific configuration check on a punctual action mode manager: verify that all the lists have been initialized and that all the items have been loaded.

Returns:
true if the list mode manager is configured, false otherwise.

Reimplemented from ModeManager.

Definition at line 86 of file PunctualActionListModeManager.cpp.

void PunctualActionListModeManager::next void   )  [virtual]
 

Iteration method to be used in conjunction with methods first and isIterationFinished.

See also:
first

Implements PunctualActionModeManager.

Definition at line 69 of file PunctualActionListModeManager.cpp.

void PunctualActionListModeManager::setListItem unsigned int  n,
unsigned int  pos,
PunctualAction pItem
 

Load an item in a list.

The item pItem is loaded in the pos-th position of the n-th list. A check is performed on the legality of the n and pos arguments. If they are found to be out of range, the fact is reported as an event of type EVT_ILLEGAL_MM.

Parameters:
n the list index
pos the position within the list where the item is loaded
pItem the item to be loaded

Definition at line 50 of file PunctualActionListModeManager.cpp.

void PunctualActionListModeManager::setListLength unsigned int  n,
unsigned int  length
 

Set the size of the n-th list.

The n-th list is the list that is active in the n-th operational mode. A call to this method causes memory to be allocated to store the items in the n-th list. The newly allocated memory is initialized to pNULL.

This is an initialization method. It should only be called once.

Parameters:
n the list index (should be in the range [0,N-1] where N is the number of modes)
length the number of items in the list-th telemetry packet list (should be greater than zero)

Definition at line 38 of file PunctualActionListModeManager.cpp.


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