ALMA Computing Group

PowerSupply Class Reference
[ACS Components Examples]

Simulates the behavior of a power supply and overwrites an ACS property. More...

#include <acsexmplPowerSupplyImpl.h>

Inheritance diagram for PowerSupply:

Inheritance graph
[legend]
List of all members.

Public Member Functions

 PowerSupply (const ACE_CString &name, maci::ContainerServices *containerServices)
 Constructor.
virtual ~PowerSupply ()
 Destructor.
virtual baci::ActionRequest invokeAction (int function, baci::BACIComponent *component_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 *component_p, const int &callbackID, const CBDescIn &descIn, baci::BACIValue *value_p, Completion &completion, CBDescOut &descOut)
 Implementation of async.
virtual baci::ActionRequest offAction (baci::BACIComponent *component_p, const int &callbackID, const CBDescIn &descIn, baci::BACIValue *value_p, Completion &completion, CBDescOut &descOut)
 Implementation of async.
virtual baci::ActionRequest resetAction (baci::BACIComponent *component_p, const int &callbackID, const CBDescIn &descIn, baci::BACIValue *value_p, Completion &completion, CBDescOut &descOut)
 Implementation of async.
virtual void on (ACS::CBvoid_ptr cb, const ACS::CBDescIn &desc)
 Switches on the power supply.
virtual void off (ACS::CBvoid_ptr cb, const ACS::CBDescIn &desc)
 Switches off the power supply.
virtual void reset (ACS::CBvoid_ptr cb, const ACS::CBDescIn &desc)
 Resets the power supply.
virtual ACS::RWdouble_ptr current ()
 Returns a reference to the current_p property (commanded current).
virtual ACS::ROdouble_ptr readback ()
 Returns a reference to the readback_p property (actual current).
virtual ACS::ROpattern_ptr status ()
 Returns a reference to the status_p property (see acsexmplPowerSupplyImpl.cpp).
virtual void execute ()
 Called after initialize to tell the component that it has to be ready to accept incoming functional calls any time.

Protected Attributes

baci::SmartPropertyPointer<
baci::ROpattern > 
m_status_sp
 m_status_sp is the PowerSupply's state (values are in CDB).

Private Member Functions

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

Private Attributes

baci::SmartPropertyPointer<
baci::ROdouble > 
m_readback_sp
 m_readback_sp is the actual value of PowerSupply's current.
baci::SmartPropertyPointer<
PowerSupplyCurrent
m_current_sp
 m_current_sp is the commanded current.

Detailed Description

Simulates the behavior of a power supply and overwrites an ACS property.

The class PowerSupply simulates the behaviour of a power supply. It provides three methods: on, off and reset. It also provides the properties current, readback and status. 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: acsexmplPowerSupplyImpl.h,v 1.106 2008/10/09 08:41:11 cparedes Exp $"

Definition at line 138 of file acsexmplPowerSupplyImpl.h.


Constructor & Destructor Documentation

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

Constructor.

Parameters:
name component name
containerService A pointer to the container services
Definition at line 52 of file acsexmplPowerSupplyImpl.cpp.

PowerSupply::~PowerSupply  )  [virtual]
 

Destructor.

Definition at line 86 of file acsexmplPowerSupplyImpl.cpp.


Member Function Documentation

ACS::RWdouble_ptr PowerSupply::current  )  [virtual]
 

Returns a reference to the current_p property (commanded current).

Implementation of IDL interface for the property.

Returns:
a pointer to the property

Definition at line 261 of file acsexmplPowerSupplyImpl.cpp.

References m_current_sp.

void PowerSupply::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).

Returns:
void
Exceptions:
ACSErr::ACSbaseExImpl 

Definition at line 74 of file acsexmplPowerSupplyImpl.cpp.

References m_status_sp.

ActionRequest PowerSupply::invokeAction int  function,
baci::BACIComponent *  component_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
component_p owner of the action
callbackID id of the callback to be notified
descIn callback descriptor (passed by client)
value_p 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::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)

Reimplemented in RampedPowerSupply.

Definition at line 97 of file acsexmplPowerSupplyImpl.cpp.

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

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

Switches off the power supply.

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 PowerSupply::offAction The given callback is used to inform the caller when the action is performed.

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

Definition at line 243 of file acsexmplPowerSupplyImpl.cpp.

References OFF_ACTION.

ActionRequest PowerSupply::offAction baci::BACIComponent *  component_p,
const int &  callbackID,
const CBDescIn &  descIn,
baci::BACIValue *  value_p,
Completion &  completion,
CBDescOut &  descOut
[virtual]
 

Implementation of async.

off() method This is the function that actually switches off the PowerSupply and, when completed, invokes the callback installed by the client when it requested the action.

Parameters:
component_p Owner of the action.
callbackID ID of the callback to be notified.
descIn Callback descriptor (passed by client).
value_p 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::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 162 of file acsexmplPowerSupplyImpl.cpp.

References m_status_sp.

Referenced by RampedPowerSupply::invokeAction(), and invokeAction().

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

Switches on the power supply.

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 PowerSupply::onAction The given callback is used to inform the caller when the action is performed.

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

Definition at line 234 of file acsexmplPowerSupplyImpl.cpp.

References ON_ACTION.

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

Implementation of async.

on() method This is the function that actually switches on the PowerSupply and, when completed, invokes the callback installed by the client when it requested the action.

Parameters:
component_p Owner of the action.
callbackID ID of the callback to be notified.
descIn Callback descriptor (passed by client).
value_p 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::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 acsexmplPowerSupplyImpl.cpp.

References m_status_sp.

Referenced by RampedPowerSupply::invokeAction(), and invokeAction().

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

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

ACS::ROdouble_ptr PowerSupply::readback  )  [virtual]
 

Returns a reference to the readback_p property (actual current).

Implementation of IDL interface for the property.

Returns:
a pointer to the property

Definition at line 273 of file acsexmplPowerSupplyImpl.cpp.

References m_readback_sp.

void PowerSupply::reset ACS::CBvoid_ptr  cb,
const ACS::CBDescIn &  desc
[virtual]
 

Resets the power supply.

Implementation of IDL reset() 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 PowerSupply::resetAction The given callback is used to inform the caller when the action is performed.

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

Definition at line 252 of file acsexmplPowerSupplyImpl.cpp.

References RESET_ACTION.

ActionRequest PowerSupply::resetAction baci::BACIComponent *  component_p,
const int &  callbackID,
const CBDescIn &  descIn,
baci::BACIValue *  value_p,
Completion &  completion,
CBDescOut &  descOut
[virtual]
 

Implementation of async.

reset() method This is the function that actually resets the PowerSupply and, when completed, invokes the callback installed by the client when it requested the action.

Parameters:
component_p Owner of the action.
callbackID ID of the callback to be notified.
descIn Callback descriptor (passed by client).
value_p 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 196 of file acsexmplPowerSupplyImpl.cpp.

References m_status_sp.

Referenced by RampedPowerSupply::invokeAction(), and invokeAction().

ACS::ROpattern_ptr PowerSupply::status  )  [virtual]
 

Returns a reference to the status_p property (see acsexmplPowerSupplyImpl.cpp).

Implementation of IDL interface for the property.

Returns:
a pointer to the property

Definition at line 286 of file acsexmplPowerSupplyImpl.cpp.

References m_status_sp.


Member Data Documentation

baci::SmartPropertyPointer<PowerSupplyCurrent> PowerSupply::m_current_sp [private]
 

m_current_sp is the commanded current.

Definition at line 395 of file acsexmplPowerSupplyImpl.h.

Referenced by current().

baci::SmartPropertyPointer<baci::ROdouble> PowerSupply::m_readback_sp [private]
 

m_readback_sp is the actual value of PowerSupply's current.

Definition at line 390 of file acsexmplPowerSupplyImpl.h.

Referenced by readback().

baci::SmartPropertyPointer<baci::ROpattern> PowerSupply::m_status_sp [protected]
 

m_status_sp is the PowerSupply's state (values are in CDB).

Definition at line 383 of file acsexmplPowerSupplyImpl.h.

Referenced by execute(), offAction(), onAction(), resetAction(), and status().


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