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

FilterWheel Class Reference
[ACS Components Examples]

#include <acsexmplFilterWheelImpl.h>

Inheritance diagram for FilterWheel:

Inheritance graph
[legend]
Collaboration diagram for FilterWheel:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 FilterWheel (const ACE_CString &name, maci::ContainerServices *containerServices)
virtual ~FilterWheel ()
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 moveFilterAction (baci::BACIComponent *cob_p, const int &callbackID, const CBDescIn &descIn, baci::BACIValue *value_p, Completion &completion, CBDescOut &descOut)
virtual baci::ActionRequest moveSlotAction (baci::BACIComponent *cob_p, const int &callbackID, const CBDescIn &descIn, baci::BACIValue *value_p, Completion &completion, CBDescOut &descOut)
virtual baci::ActionRequest adjustAction (baci::BACIComponent *cob_p, const int &callbackID, const CBDescIn &descIn, baci::BACIValue *value_p, Completion &completion, CBDescOut &descOut)
virtual void moveFilterInBeam (const char *, ACS::CBvoid_ptr, const ACS::CBDescIn &)
virtual void moveSlotInBeam (int, ACS::CBvoid_ptr, const ACS::CBDescIn &)
virtual void adjust (int, ACS::CBvoid_ptr, const ACS::CBDescIn &)
virtual CORBA::Long calibrateFilter (const char *name)
virtual CORBA::Long calibrateWheel (int slot)
virtual ACS::ROdouble_ptr position ()
virtual ACS::ROstring_ptr desc ()
virtual ACS::ROlong_ptr slots ()

Private Member Functions

void readConfiguration (Descriptor *descr)
void updateFilter (ACE_CString name, int delta)
void updateWheel (int slot, int step)
void operator= (const FilterWheel &)

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
Descriptorm_wheelConfiguration

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 $"


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

virtual FilterWheel::~FilterWheel  )  [virtual]
 

Destructor


Member Function Documentation

virtual 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 *

*

Reimplemented from acscomponent::ACSComponentImpl.

virtual 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

virtual baci::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).


virtual 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

virtual 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

virtual 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 *

*

Reimplemented from acscomponent::ACSComponentImpl.

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

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


virtual 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 *

*

Reimplemented from acscomponent::ACSComponentImpl.

virtual 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 *

*

Reimplemented from acscomponent::ACSComponentImpl.

virtual baci::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).


Implements baci::ActionImplementator.

virtual baci::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).


virtual 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.

virtual baci::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).


virtual 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.

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

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

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

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


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

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

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


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

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


Member Data Documentation

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

m_desc_sp is the description of the wheel.

ACE_CString FilterWheel::m_fullName [private]
 

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

m_position_sp is the position of the wheel.

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

m_slots_sp is the number of available slots in the wheel

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


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