ALMA Computing Group

FilterWheel Class Reference
[ACS Components Examples]

The class FilterWheel class simulates the behavior of a very simple filter wheel. More...

#include <acsexmplFilterWheelImpl.h>

Collaboration diagram for FilterWheel:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 FilterWheel (const ACE_CString &name, maci::ContainerServices *containerServices)
 Constructor.
virtual ~FilterWheel ()
 Destructor.
virtual void initialize ()
 Called to give the component time to initialize itself.
virtual void execute ()
 Called after initialize to tell the component that it has to be ready to accept incoming functional calls any time.
virtual void cleanUp ()
 Called after the last functional call to the component has finished.
virtual void aboutToAbort ()
 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...).
virtual baci::ActionRequest invokeAction (int function, baci::BACIComponent *cob_p, const int &callbackID, const CBDescIn &descIn, baci::BACIValue *value_p, Completion &completion, CBDescOut &descOut)
 Action dispatcher function This function is called whenever an asynchronous request has to be handled.
virtual baci::ActionRequest moveFilterAction (baci::BACIComponent *cob_p, const int &callbackID, const CBDescIn &descIn, baci::BACIValue *value_p, Completion &completion, CBDescOut &descOut)
 Implementation of asynchrnous moveFilterInBeam method This is the function that actually rotate the wheel to the slot of the selected filter (it also take in account the per-filter adjustament represented by the delta filed in the description of the filter in the CDB) When completed, invokes the callback installed by the client when it requested the action.
virtual baci::ActionRequest moveSlotAction (baci::BACIComponent *cob_p, const int &callbackID, const CBDescIn &descIn, baci::BACIValue *value_p, Completion &completion, CBDescOut &descOut)
 Implementation of asynchrnous moveSlotInBeam method This is the function that actually rotate the wheel to the selected slot When completed, invokes the callback installed by the client when it requested the action.
virtual baci::ActionRequest adjustAction (baci::BACIComponent *cob_p, const int &callbackID, const CBDescIn &descIn, baci::BACIValue *value_p, Completion &completion, CBDescOut &descOut)
 Implementation of asynchrnous adjust() method This is the function that moves the wheel of some steps and, when completed, invokes the callback installed by the client when it requested the action.
virtual void moveFilterInBeam (const char *, ACS::CBvoid_ptr, const ACS::CBDescIn &)
 Move the filter wheel to a specification slot.
virtual void moveSlotInBeam (int, ACS::CBvoid_ptr, const ACS::CBDescIn &)
 Move the filter wheel to a specific slot.
virtual void adjust (int, ACS::CBvoid_ptr, const ACS::CBDescIn &)
 Move the wheel of the specified number of step.
virtual CORBA::Long calibrateFilter (const char *name)
 Calibrate the delta of the filter by reading the actual position and the step of the slot where the filter is mounted (it also updates the value in the CDB).
virtual CORBA::Long calibrateWheel (int slot)
 Calibrate the step for the slot by reading the actual position (it also updates the value in the CDB).
virtual ACS::ROdouble_ptr position ()
 Returns a reference to the position property Implementation of IDL interface for the property.
virtual ACS::ROstring_ptr desc ()
 Returns a reference to the desc property Implementation of IDL interface for the property.
virtual ACS::ROlong_ptr slots ()
 Returns a reference to the descavailableSlots property Implementation of IDL interface for the property.

Private Member Functions

void readConfiguration (Descriptor *descr)
 Read the CDB to build the actual configuration of the wheel.
void updateFilter (ACE_CString name, int delta)
 Permanently write the new delta for the given filter in the CDB.
void updateWheel (int slot, int step)
 Permanently write the new position for the given slot in the CDB.
void operator= (const FilterWheel &)
 ALMA C++ coding standards state copy operators should be disabled.

Private Attributes

ACE_CString m_fullName
baci::SmartPropertyPointer<
baci::ROdouble > 
m_position_sp
 m_position_sp is the position of the wheel.
baci::SmartPropertyPointer<
baci::ROstring > 
m_desc_sp
 m_desc_sp is the description of the wheel.
baci::SmartPropertyPointer<
baci::ROlong > 
m_slots_sp
 m_slots_sp is the number of available slots in the wheel
Descriptorm_wheelConfiguration
 The array describing the actual configuration of the wheel: It is built by reading the CDB The number of item in the array is given by the number of available slots defined in the CDB.

Detailed Description

The class FilterWheel class simulates the behavior of a very simple filter wheel.

The configuration of the wheel is on the CDB. First of all the number of available slots of the wheel. This is read at startup. In the CDB there is a list of position of the slots. This is the step to rotate the wheel to have the center of the slot in the beam. The adjust method allows the user to move the wheel of some step in order to center the slot in the beam. When the center has been found, the calibrateWheel method store the position as the center for the selected slot.

In the CDB there is also the definition for each possible filter. For each filter there is its name, the slot where it is inserted in and the delta i.e. the deviation of the center of the filter in respect of the center of the slot (it could be a problem in building the filter for example, storing this number we could mount the filter in every slot) To found the center of the filter the operator uses again the adjust method. When the center is found the delta can be stored in the filter definition in the CDB using the calibrateFilter method.

The component reads the configuration of the wheel from the CDB at startup and stores number of the slots in the wheel, the position of the slots and the definition of each filter are together in the same array of structs (the number of the slot is represented by its position in the array). When one of the two calibrate methods is executed the internal data as well as the CDB values are updated.

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

Definition at line 139 of file acsexmplFilterWheelImpl.h.


Constructor & Destructor Documentation

FilterWheel::FilterWheel const ACE_CString &  name,
maci::ContainerServices *  containerServices
 

Constructor.

Parameters:
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.
containerService The pointer to the container services
Definition at line 54 of file acsexmplFilterWheelImpl.cpp.

FilterWheel::~FilterWheel  )  [virtual]
 

Destructor.

Definition at line 67 of file acsexmplFilterWheelImpl.cpp.


Member Function Documentation

void FilterWheel::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 *

*
Definition at line 316 of file acsexmplFilterWheelImpl.cpp.

void FilterWheel::adjust int  ,
ACS::CBvoid_ptr  ,
const ACS::CBDescIn & 
[virtual]
 

Move the wheel of the specified number of step.

Parameters:
the step to move the wheel
Definition at line 512 of file acsexmplFilterWheelImpl.cpp.

References ADJUST_ACTION.

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

Implementation of asynchrnous adjust() method This is the function that moves the wheel of some steps 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).


Definition at line 360 of file acsexmplFilterWheelImpl.cpp.

References m_position_sp.

Referenced by invokeAction().

CORBA::Long FilterWheel::calibrateFilter const char *  name  )  [virtual]
 

Calibrate the delta of the filter by reading the actual position and the step of the slot where the filter is mounted (it also updates the value in the CDB).

Parameters:
name The name of the filter to calibrate
Returns:
The new delta for the filter
Definition at line 535 of file acsexmplFilterWheelImpl.cpp.

References m_position_sp, m_slots_sp, m_wheelConfiguration, Descriptor::step, and updateFilter().

CORBA::Long FilterWheel::calibrateWheel int  slot  )  [virtual]
 

Calibrate the step for the slot by reading the actual position (it also updates the value in the CDB).

Parameters:
slot The number of the slot to calibrate
Returns:
The new step for the slot
Definition at line 518 of file acsexmplFilterWheelImpl.cpp.

References m_position_sp, m_slots_sp, m_wheelConfiguration, Descriptor::step, and updateWheel().

void FilterWheel::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 *

*
Definition at line 309 of file acsexmplFilterWheelImpl.cpp.

References m_wheelConfiguration.

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

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



Definition at line 581 of file acsexmplFilterWheelImpl.cpp.

References m_desc_sp.

void FilterWheel::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

Exceptions:
ACSErr::ACSbaseExImpl 
Returns:
void *

*
Definition at line 301 of file acsexmplFilterWheelImpl.cpp.

References m_wheelConfiguration, and readConfiguration().

void FilterWheel::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.

Parameters:
containerServices pointer to services provided by the container
Exceptions:
ACSErr::ACSbaseExImpl 
Returns:
void *

*
Definition at line 214 of file acsexmplFilterWheelImpl.cpp.

References Descriptor::delta, Descriptor::filterName, m_desc_sp, m_fullName, m_position_sp, m_slots_sp, m_wheelConfiguration, and Descriptor::step.

ActionRequest FilterWheel::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).


Definition at line 323 of file acsexmplFilterWheelImpl.cpp.

References ADJUST_ACTION, adjustAction(), MOVEFILTER_ACTION, moveFilterAction(), MOVESLOT_ACTION, and moveSlotAction().

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

Implementation of asynchrnous moveFilterInBeam method This is the function that actually rotate the wheel to the slot of the selected filter (it also take in account the per-filter adjustament represented by the delta filed in the description of the filter in the CDB) 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).


Definition at line 397 of file acsexmplFilterWheelImpl.cpp.

References Descriptor::delta, Descriptor::filterName, m_position_sp, m_slots_sp, and m_wheelConfiguration.

Referenced by invokeAction().

void FilterWheel::moveFilterInBeam const char *  ,
ACS::CBvoid_ptr  ,
const ACS::CBDescIn & 
[virtual]
 

Move the filter wheel to a specification slot.

Implementation of IDL moveFilterInBeam(...) 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. Definition at line 498 of file acsexmplFilterWheelImpl.cpp.

References MOVEFILTER_ACTION.

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

Implementation of asynchrnous moveSlotInBeam method This is the function that actually rotate the wheel to the selected slot 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).


Definition at line 453 of file acsexmplFilterWheelImpl.cpp.

References m_position_sp, m_slots_sp, and m_wheelConfiguration.

Referenced by invokeAction().

void FilterWheel::moveSlotInBeam int  ,
ACS::CBvoid_ptr  ,
const ACS::CBDescIn & 
[virtual]
 

Move the filter wheel to a specific slot.

Implementation of IDL moveSlotInBeam(...) 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. Definition at line 506 of file acsexmplFilterWheelImpl.cpp.

References MOVESLOT_ACTION.

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

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

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

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



Definition at line 569 of file acsexmplFilterWheelImpl.cpp.

References m_position_sp.

void FilterWheel::readConfiguration Descriptor descr  )  [private]
 

Read the CDB to build the actual configuration of the wheel.

Parameters:
descr The list of descriptor describing the actual configuration of the wheel
Definition at line 72 of file acsexmplFilterWheelImpl.cpp.

References Descriptor::delta, m_fullName, m_slots_sp, and Descriptor::step.

Referenced by execute().

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

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



Definition at line 593 of file acsexmplFilterWheelImpl.cpp.

References m_slots_sp.

void FilterWheel::updateFilter ACE_CString  name,
int  delta
[private]
 

Permanently write the new delta for the given filter in the CDB.

Parameters:
name The name of the filter
delta The new offset for the filter
Definition at line 153 of file acsexmplFilterWheelImpl.cpp.

References m_fullName.

Referenced by calibrateFilter().

void FilterWheel::updateWheel int  slot,
int  step
[private]
 

Permanently write the new position for the given slot in the CDB.

Parameters:
slot: The number of the slot to update
step: the new position of the slot
Definition at line 175 of file acsexmplFilterWheelImpl.cpp.

References m_fullName.

Referenced by calibrateWheel().


Member Data Documentation

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

m_desc_sp is the description of the wheel.

Definition at line 479 of file acsexmplFilterWheelImpl.h.

Referenced by desc(), and initialize().

ACE_CString FilterWheel::m_fullName [private]
 

Definition at line 468 of file acsexmplFilterWheelImpl.h.

Referenced by initialize(), readConfiguration(), updateFilter(), and updateWheel().

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

m_position_sp is the position of the wheel.

Definition at line 474 of file acsexmplFilterWheelImpl.h.

Referenced by adjustAction(), calibrateFilter(), calibrateWheel(), initialize(), moveFilterAction(), moveSlotAction(), and position().

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

m_slots_sp is the number of available slots in the wheel

Definition at line 485 of file acsexmplFilterWheelImpl.h.

Referenced by calibrateFilter(), calibrateWheel(), initialize(), moveFilterAction(), moveSlotAction(), readConfiguration(), and slots().

Descriptor* FilterWheel::m_wheelConfiguration [private]
 

The array describing the actual configuration of the wheel: It is built by reading the CDB The number of item in the array is given by the number of available slots defined in the CDB.

Definition at line 493 of file acsexmplFilterWheelImpl.h.

Referenced by calibrateFilter(), calibrateWheel(), cleanUp(), execute(), initialize(), moveFilterAction(), and moveSlotAction().


The documentation for this class was generated from the following files: