ALMA Computing Group

Lamp Class Reference
[ACS Components Examples]

Simple component with asynchronous methods. More...

#include <acsexmplLampImpl.h>

List of all members.

Public Member Functions

 Lamp (const ACE_CString &name, maci::ContainerServices *containerServices)
 Constructor.
virtual ~Lamp ()
 Destructor.
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 onAction (baci::BACIComponent *cob_p, const int &callbackID, const CBDescIn &descIn, baci::BACIValue *value_p, Completion &completion, CBDescOut &descOut)
 Implementation of asynchronous acsexmplLamp::Lamp::on() method This is the function that actually switches on the Lamp and, when completed, invokes the callback installed by the client when it requested the action.
virtual baci::ActionRequest offAction (baci::BACIComponent *cob_p, const int &callbackID, const CBDescIn &descIn, baci::BACIValue *value_p, Completion &completion, CBDescOut &descOut)
 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.
virtual void on (ACS::CBvoid_ptr cb, const ACS::CBDescIn &desc)
 Switches on the lamp.
virtual void off (ACS::CBvoid_ptr cb, const ACS::CBDescIn &desc)
 Switches off the lamp.
virtual ACS::RWdouble_ptr brightness ()
 Returns a reference to the Brightness property Implementation of IDL interface for the property.

Private Member Functions

void operator= (const Lamp &)
 ALMA C++ coding standards state copy operators should be disabled.

Private Attributes

baci::SmartPropertyPointer<
baci::RWdouble > 
m_brightness_sp
 m_brightness_sp is the lamp's setable brightness.


Detailed Description

Simple component with asynchronous methods.

This class Lamp simulates the behavior of a lamp. It provides two asynchronous methods: on and off. It also provides the property brightness. Lastly, it implements timeout negotiation between client and servant for the two methods. Asynchronous calls are implemented using the ...... pattern and the ..... support classes. For each xxx action defined in the IDL interface two methods are provided:

Author:
Matej Sekoranja, Jozef Stefan Institute, Slovenia
Version:
"@(#) $Id: acsexmplLampImpl.h,v 1.99 2008/10/01 04:30:47 cparedes Exp $"

Definition at line 111 of file acsexmplLampImpl.h.


Constructor & Destructor Documentation

Lamp::Lamp 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.
containerServices The pointer to the ContainerServices
Definition at line 57 of file acsexmplLampImpl.cpp.

Lamp::~Lamp  )  [virtual]
 

Destructor.

Definition at line 68 of file acsexmplLampImpl.cpp.


Member Function Documentation

ACS::RWdouble_ptr Lamp::brightness  )  [virtual]
 

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



Definition at line 170 of file acsexmplLampImpl.cpp.

References m_brightness_sp.

ActionRequest Lamp::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 78 of file acsexmplLampImpl.cpp.

References OFF_ACTION, offAction(), ON_ACTION, and onAction().

void Lamp::off ACS::CBvoid_ptr  cb,
const ACS::CBDescIn &  desc
[virtual]
 

Switches off the lamp.

Implementation of IDL off() interface. This method just registers the request in the asyncronous queue, together with the associated callback and returns control immediatly. The actual action will be invoked asyncronously by the asynchonous call manager by calling Lamp::offAction The given callback is used to inform the caller when the action is performed.

Parameters:
callBack Callback when action has finished.
desc Callback used for holding information on timeout periods.

Definition at line 161 of file acsexmplLampImpl.cpp.

References OFF_ACTION.

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


Definition at line 131 of file acsexmplLampImpl.cpp.

Referenced by invokeAction().

void Lamp::on ACS::CBvoid_ptr  cb,
const ACS::CBDescIn &  desc
[virtual]
 

Switches on the lamp.

Implementation of IDL on() interface. This method just registers the request in the asyncronous queue, together with the associated callback and returns control immediatly. The actual action will be invoked asyncronously by the asynchonous call manager by calling Lamp::onAction The given callback is used to inform the caller when the action is performed.

Parameters:
callBack Callback when action has finished.
desc Callback used for holding information on timeout periods

Definition at line 152 of file acsexmplLampImpl.cpp.

References ON_ACTION.

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

Implementation of asynchronous acsexmplLamp::Lamp::on() method This is the function that actually switches on 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).


Definition at line 109 of file acsexmplLampImpl.cpp.

Referenced by invokeAction().

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

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


Member Data Documentation

baci::SmartPropertyPointer<baci::RWdouble> Lamp::m_brightness_sp [private]
 

m_brightness_sp is the lamp's setable brightness.

Definition at line 277 of file acsexmplLampImpl.h.

Referenced by brightness().


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