ALMA Computing Group

Door Class Reference
[ACS Components Examples]

Door is a simple component that utilizes just about every ACS API. More...

#include <acsexmplDoorImpl.h>

Collaboration diagram for Door:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 Door (const ACE_CString &name, maci::ContainerServices *containerServices)
 Constructor.
virtual ~Door ()
 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 openAction (baci::BACIComponent *component_p, const int &callbackID, const CBDescIn &descIn, baci::BACIValue *value_p, Completion &completion, CBDescOut &descOut)
 Implementation of asynch.
virtual baci::ActionRequest closeAction (baci::BACIComponent *component_p, const int &callbackID, const CBDescIn &descIn, baci::BACIValue *value_p, Completion &completion, CBDescOut &descOut)
 Implementation of asynch.
virtual void open (ACS::CBvoid_ptr cb, const ACS::CBDescIn &desc)
 Opens the door Implementation of IDL open() interface.
virtual void close (ACS::CBvoid_ptr cb, const ACS::CBDescIn &desc)
 Closes the door Implementation of IDL close() interface.
virtual void move (CORBA::Double pos)
 Moves the door to the given position Implementation of the IDL move(...) interface.
virtual ACS::ROdouble_ptr position ()
 Property for readback m_position_p Implementation of IDL interface for the property.
virtual ACS::RWdouble_ptr ref_position ()
 Property for reference position Implementation of IDL interface for the property.
virtual ACS::ROlong_ptr substate ()
 Property for substate Implementation of IDL interface for the property.
virtual ACS::ROstring_ptr version ()
 Property for version Implementation of IDL interface for the property.
virtual void execute ()
 Called after initialize to tell the component that it has to be ready to accept incoming functional calls any time.

Private Member Functions

virtual void checkSubstate (CompletionImpl *&error_p)
 Checks substate Checks for the device's substate.
void operator= (const Door &)
 ALMA C++ coding standards state copy operators should be disabled.

Private Attributes

baci::SmartPropertyPointer<
baci::RWdouble > 
m_ref_position_sp
 m_ref_position_sp is the position the Door should be in
baci::SmartPropertyPointer<
baci::ROdouble > 
m_position_sp
 m_position_sp is the Door's actual position
baci::SmartPropertyPointer<
baci::ROlong > 
m_substate_sp
 m_substate_sp is the state the door is currently in
baci::SmartPropertyPointer<
baci::ROstring > 
m_version_sp
 m_version_sp is the Door's current version
DoorThreadm_doorThread_p

Friends

void DoorThread::runLoop ()

Detailed Description

Door is a simple component that utilizes just about every ACS API.

This class implements an example device "Door". It provides both synchronous (move(...)) and asynchronous methods (open() and close()). A control loop thread simulates the door's movements. Error and exception handling have been included. Asynchronous calls are implemented using the callback pattern via a support class. For each xxx action defined in the IDL interface two methods are provided:

Definition at line 157 of file acsexmplDoorImpl.h.


Constructor & Destructor Documentation

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

Constructor.

Parameters:
poa poa which will activate this and also all other components
name component name
Definition at line 150 of file acsexmplDoorImpl.cpp.

Door::~Door  )  [virtual]
 

Destructor.

Definition at line 193 of file acsexmplDoorImpl.cpp.

References m_doorThread_p.


Member Function Documentation

void Door::checkSubstate CompletionImpl *&  error_p  )  [private, virtual]
 

Checks substate Checks for the device's substate.

If the device is busy it returns an error. The purpose of this function is to show how to handle local error information.

Parameters:
error completion return variable
Returns:
void

Definition at line 208 of file acsexmplDoorImpl.cpp.

References DOOR_CLOSING, DOOR_OPENING, m_substate_sp, and substate().

Referenced by closeAction(), move(), and openAction().

void Door::close ACS::CBvoid_ptr  cb,
const ACS::CBDescIn &  desc
[virtual]
 

Closes the door Implementation of IDL close() 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 Door::closeAction 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
Returns:
void

Definition at line 377 of file acsexmplDoorImpl.cpp.

References CLOSE_ACTION.

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

Implementation of asynch.

close() method This is the function that actually closes the Door 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 action data (e.g., parameters to the original CORBA method)
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 315 of file acsexmplDoorImpl.cpp.

References checkSubstate(), and m_ref_position_sp.

Referenced by invokeAction().

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

Exceptions:
ACSErr::ACSbaseExImpl 
Returns:
void

Definition at line 162 of file acsexmplDoorImpl.cpp.

References DOOR_UNDEFINED, m_doorThread_p, m_substate_sp, and m_version_sp.

ActionRequest Door::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., parameters to the original CORBA method)
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 233 of file acsexmplDoorImpl.cpp.

References CLOSE_ACTION, closeAction(), OPEN_ACTION, and openAction().

void Door::move CORBA::Double  pos  )  [virtual]
 

Moves the door to the given position Implementation of the IDL move(...) interface.

This method, while synchronous, only changes the reference position (i.e., m_ref_position_p) while DoorThread actually handles the change in the door position via an ACS thread.

Parameters:
pos requested position - must be between 0 and a 100.
Returns:
void

Definition at line 384 of file acsexmplDoorImpl.cpp.

References checkSubstate(), and m_ref_position_sp.

void Door::open ACS::CBvoid_ptr  cb,
const ACS::CBDescIn &  desc
[virtual]
 

Opens the door Implementation of IDL open() 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 Door::openAction 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
Returns:
void

Definition at line 370 of file acsexmplDoorImpl.cpp.

References OPEN_ACTION.

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

Implementation of asynch.

open() method This is the function that actually opens the Door 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., parameters to the original CORBA method)
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 260 of file acsexmplDoorImpl.cpp.

References checkSubstate(), and m_ref_position_sp.

Referenced by invokeAction().

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

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

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

Property for readback m_position_p Implementation of IDL interface for the property.

Returns:
Read-only double pointer to the door's current position

Definition at line 435 of file acsexmplDoorImpl.cpp.

References m_position_sp.

ACS::RWdouble_ptr Door::ref_position  )  [virtual]
 

Property for reference position Implementation of IDL interface for the property.

Returns:
Read/write double pointer to where the door should be physically located

Definition at line 423 of file acsexmplDoorImpl.cpp.

References m_ref_position_sp.

ACS::ROlong_ptr Door::substate  )  [virtual]
 

Property for substate Implementation of IDL interface for the property.

Returns:
Read-only long integer pointer to the door's present state

Definition at line 447 of file acsexmplDoorImpl.cpp.

References m_substate_sp.

Referenced by checkSubstate().

ACS::ROstring_ptr Door::version  )  [virtual]
 

Property for version Implementation of IDL interface for the property.

Returns:
Read-only string pointer to the door implementation's version

Definition at line 459 of file acsexmplDoorImpl.cpp.

References m_version_sp.


Friends And Related Function Documentation

void DoorThread::runLoop  )  [friend]
 


Member Data Documentation

DoorThread* Door::m_doorThread_p [private]
 

Definition at line 422 of file acsexmplDoorImpl.h.

Referenced by execute(), and ~Door().

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

m_position_sp is the Door's actual position

Definition at line 406 of file acsexmplDoorImpl.h.

Referenced by position(), and DoorThread::runLoop().

baci::SmartPropertyPointer<baci::RWdouble> Door::m_ref_position_sp [private]
 

m_ref_position_sp is the position the Door should be in

Definition at line 401 of file acsexmplDoorImpl.h.

Referenced by closeAction(), move(), openAction(), ref_position(), and DoorThread::runLoop().

baci::SmartPropertyPointer<baci::ROlong> Door::m_substate_sp [private]
 

m_substate_sp is the state the door is currently in

See also:
acsexmplDoorImpl.cpp
Definition at line 412 of file acsexmplDoorImpl.h.

Referenced by checkSubstate(), execute(), DoorThread::runLoop(), and substate().

baci::SmartPropertyPointer<baci::ROstring> Door::m_version_sp [private]
 

m_version_sp is the Door's current version

Definition at line 417 of file acsexmplDoorImpl.h.

Referenced by execute(), and version().


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