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

LampWheel Class Reference
[ACS Components Examples]

#include <acsexmplLampWheelImpl.h>

Inheritance diagram for LampWheel:

Inheritance graph
[legend]
Collaboration diagram for LampWheel:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 LampWheel (const ACE_CString &name, maci::ContainerServices *containerServices)
virtual ~LampWheel ()
virtual void initialize ()
virtual void execute ()
virtual void cleanUp ()
virtual void aboutToAbort ()
virtual baci::ActionRequest invokeAction (int function, baci::BACIComponent *cob_p, const int &callbackID, const CBDescIn &descIn, baci::BACIValue *value_p, Completion &completion, CBDescOut &descOut)
virtual baci::ActionRequest moveAction (baci::BACIComponent *cob_p, const int &callbackID, const CBDescIn &descIn, baci::BACIValue *value_p, Completion &completion, CBDescOut &descOut)
virtual void move (CORBA::Short, ACS::CBvoid_ptr, const ACS::CBDescIn &)
virtual ACS::ROdouble_ptr position ()
virtual ACS::ROstring_ptr desc ()
virtual ACS::ROlong_ptr slots ()

Private Member Functions

void operator= (const LampWheel &)
int retrieveConfigurationFromCDB (std::list< SlotDescriptor > &config)

Static Private Member Functions

void start_hndl (void *data, const XML_Char *el, const XML_Char **attr)
void end_hndl (void *data, const XML_Char *el)
void char_hndl (void *data, const XML_Char *s, int len)

Private Attributes

ACE_CString m_fullName
baci::SmartPropertyPointer<
baci::ROdouble
m_position_sp
baci::SmartPropertyPointer<
baci::ROstring
m_desc_sp
baci::SmartPropertyPointer<
baci::ROlong
m_slots_sp
std::list< SlotDescriptorm_lampWheelConfiguration

Detailed Description

The class LampWheel class simulates the behavior of a very simple lamp wheel using an asynchronous method to rotate it.

The component reads the wheel data from the CDB. The lamp wheel is caracterized by a description, a number of available slots and a description of the used slots. All these data reside on the CDB. In particular, the number of defined slots is not defined a priori but is retrieved by parsing the CDB record for the component.

At startup, the component read the description of the wheel from the CDB and stores the configuration into a list. The move method moves the wheel to the position defined for the passed slot number. The position is read from the list (i.e. from the CDB). A log message inform the user about the selected lamp.

Author:
Alessandro Caproni,
Version:
"@(#) $Id: acsexmplLampWheelImpl.h,v 1.16 2008/10/09 08:41:11 cparedes Exp $"


Constructor & Destructor Documentation

LampWheel::LampWheel const ACE_CString &  name,
maci::ContainerServices containerServices
 

Constructor

Parameters:
poa Poa which will activate this and also all other components.
name component's name. This is also the name that will be used to find the configuration data for the component in the Configuration Database.

virtual LampWheel::~LampWheel  )  [virtual]
 

Destructor


Member Function Documentation

virtual void LampWheel::aboutToAbort  )  [virtual]
 

Called when due to some error condition the component is about to be forcefully removed some unknown amount of time later (usually not very much...). The component should make an effort to die as neatly as possible. Because of its urgency, this method will be called asynchronously to the execution of any other method of the component. If this method is overwritten in a chain of subclasses, the developer might need to make sure that all activities performed by the implementation of the base class take place. Check the documentation of direct parent class to know if this is necessary (and do not forget to document each class for the need to chain lifecycle methods in subclasses). The best way to do this is to call the implementation of the base itself explicitly, as would be done implicitly in a constructor chain. In this class the default implementation only sets the state of the component to acscomponent::ACS::ACS::COMPSTATE_ABORTING

Returns:
void *

*

Reimplemented from acscomponent::ACSComponentImpl.

void LampWheel::char_hndl void *  data,
const XML_Char s,
int  len
[static, private]
 

The handler for the char element

See also:
libexpat documentation for further info

virtual void LampWheel::cleanUp  )  [virtual]
 

Called after the last functional call to the component has finished. The component should then orderly release resources etc. If this method is overwritten in a subclass, the developer has to make sure that all cleanup performed by the implementation of the base class take place. The best way to do this is to call the implementation of the base itself explicitly, as would be done implicitly in a destructor chain. If this method is overwritten in a chain of subclasses, the developer might need to make sure that all activities performed by the implementation of the base class take place. Check the documentation of direct parent class to know if this is necessary (and do not forget to document each class for the need to chain lifecycle methods in subclasses). The best way to do this is to call the implementation of the base itself explicitly, as would be done implicitly in a destructor chain. In this class the default implementation only sets the state of the component to acscomponent::ACS::COMPSTATE_DESTROYING

Returns:
void *

*

Reimplemented from acscomponent::ACSComponentImpl.

virtual ACS::ROstring_ptr LampWheel::desc  )  [virtual]
 

Returns a reference to the desc property Implementation of IDL interface for the property.


void LampWheel::end_hndl void *  data,
const XML_Char el
[static, private]
 

The handler for the end element

See also:
libexpat documentation for further info

virtual void LampWheel::execute  )  [virtual]
 

Called after initialize to tell the component that it has to be ready to accept incoming functional calls any time. Must be implemented as a synchronous (blocking) call (can spawn threads though). If this method is overwritten in a chain of subclasses, the developer might need to make sure that all activities performed by the implementation of the base class take place. Check the documentation of direct parent class to know if this is necessary (and do not forget to document each class for the need to chain lifecycle methods in subclasses). The best way to do this is to call the implementation of the base itself explicitly, as would be done implicitly in a constructor chain. In this class the default implementation only sets the state of the component to acscomponent::ACS::COMPSTATE_OPERATIONAL

Returns:
void
Exceptions:
ACSErr::ACSbaseExImpl  *

*

Reimplemented from acscomponent::ACSComponentImpl.

virtual void LampWheel::initialize  )  [virtual]
 

Called to give the component time to initialize itself. For instance, the component could retrieve connections, read in configuration files/parameters, build up in-memory tables, ... Called before execute. In fact, this method might be called quite some time before functional requests can be sent to the component. Must be implemented as a synchronous (blocking) call. If this method is overwritten in a chain of subclasses, the developer has to make sure that all initialisations performed by the implementation of the base class take place. Check the documentation of direct parent class to know if this is necessary (and do not forget to document each class for the need to chain lifecycle methods in subclasses). If necessary, the best way to do this is to call the implementation of the base itself explicitly, as would be done implicitly in a constructor chain. In this class the default implementation only sets the state of the component first to acscomponent::ACS::COMPSTATE_INITIALIZING and then to acscomponent::ACS::COMPSTATE_INITIALIZED.

Returns:
void
Exceptions:
ACSErr::ACSbaseExImpl  *

*

Reimplemented from acscomponent::ACSComponentImpl.

virtual baci::ActionRequest LampWheel::invokeAction int  function,
baci::BACIComponent cob_p,
const int &  callbackID,
const CBDescIn descIn,
baci::BACIValue value_p,
Completion completion,
CBDescOut descOut
[virtual]
 

Action dispatcher function This function is called whenever an asynchronous request has to be handled. It receives (as parameters) the description of the function and selects the proper implementation to call.

Parameters:
function Action funtion to be invoked.
cob Owner of the action.
callbackID ID of the callback to be notified.
descIn Callback descriptor (passed by client).
value Action data (e.g. value to be set).
completion Error handing structure.
descOut Callback descriptor which will be passed to client.
Returns:
Request to be performed by BACI
  • reqNone - Do nothing (action will be kept in queue).
  • reqInvokeWorking - Invoke <type>Callback::working.
  • reqInvokeDone - Invoke <type>Callback::done and destroy callback.
  • reqDestroy - Destroy callback (callback should have been called already by function).


Implements baci::ActionImplementator.

virtual void LampWheel::move CORBA::Short  ,
ACS::CBvoid_ptr  ,
const ACS::CBDescIn
[virtual]
 

Move the lamp wheel to a specification slot. The position of the slot is read from the database Implementation of IDL move(...) interface. The actual action will be invoked asyncronously by the asynchonous call manager by calling LampWhell::moveAction The given callback is used to inform the caller when the action is performed.

Parameters:
n The number of the slot to move to
callBack Callback when action has finished.
desc Callback used for holding information on timeout periods.

virtual baci::ActionRequest LampWheel::moveAction baci::BACIComponent cob_p,
const int &  callbackID,
const CBDescIn descIn,
baci::BACIValue value_p,
Completion completion,
CBDescOut descOut
[virtual]
 

Implementation of asynchrnous acsexmplLamp::Lamp::off() method This is the function that actually switches off the Lamp and, when completed, invokes the callback installed by the client when it requested the action.

Parameters:
cob Owner of the action.
callbackID ID of the callback to be notified.
descIn Callback descriptor (passed by client).
value Action data (e.g. value to be set).
completion Error handing structure.
descOut Callback descriptor which will be passed to client.
Returns:
Request to be performed by BACI.
  • reqNone - Do nothing (action will be kept in queue).
  • reqInvokeWorking - Invoke <type>Callback::working.
  • reqInvokeDone - Invoke <type>Callback::done and destroy callback.
  • reqDestroy - Destroy callback (callback should has been called already by function).


void LampWheel::operator= const LampWheel  )  [private]
 

ALMA C++ coding standards state copy operators should be disabled.

virtual ACS::ROdouble_ptr LampWheel::position  )  [virtual]
 

Returns a reference to the position property Implementation of IDL interface for the property.


int LampWheel::retrieveConfigurationFromCDB std::list< SlotDescriptor > &  config  )  [private]
 

Read the CDB and fill the list with the actual configuration of each slot

Parameters:
config The list describing the configuration
Returns:
The number of slots found in the CDB

virtual ACS::ROlong_ptr LampWheel::slots  )  [virtual]
 

Returns a reference to the descavailableSlots property Implementation of IDL interface for the property.


void LampWheel::start_hndl void *  data,
const XML_Char el,
const XML_Char **  attr
[static, private]
 

The handler for the start element

See also:
libexpat documentation for further info


Member Data Documentation

baci::SmartPropertyPointer<baci::ROstring> LampWheel::m_desc_sp [private]
 

m_desc_sp is the description of the wheel.

ACE_CString LampWheel::m_fullName [private]
 

std::list<SlotDescriptor> LampWheel::m_lampWheelConfiguration [private]
 

The list of descriptions of each slot of the wheel: it is the configuration of the lampWheel It is built reading the CDB

baci::SmartPropertyPointer<baci::ROdouble> LampWheel::m_position_sp [private]
 

m_position_sp is the position of the wheel.

baci::SmartPropertyPointer<baci::ROlong> LampWheel::m_slots_sp [private]
 

m_slots_sp is the number of available slots in the wheel


The documentation for this class was generated from the following file:
Generated on Thu Apr 30 02:36:32 2009 for ACS C++ API by doxygen 1.3.8