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

Door Class Reference
[ACS Components Examples]

#include <acsexmplDoorImpl.h>

Inheritance diagram for Door:

Inheritance graph
[legend]
Collaboration diagram for Door:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 Door (const ACE_CString &name, maci::ContainerServices *containerServices)
virtual ~Door ()
virtual baci::ActionRequest invokeAction (int function, baci::BACIComponent *component_p, const int &callbackID, const CBDescIn &descIn, baci::BACIValue *value_p, Completion &completion, CBDescOut &descOut)
virtual baci::ActionRequest openAction (baci::BACIComponent *component_p, const int &callbackID, const CBDescIn &descIn, baci::BACIValue *value_p, Completion &completion, CBDescOut &descOut)
virtual baci::ActionRequest closeAction (baci::BACIComponent *component_p, const int &callbackID, const CBDescIn &descIn, baci::BACIValue *value_p, Completion &completion, CBDescOut &descOut)
virtual void open (ACS::CBvoid_ptr cb, const ACS::CBDescIn &desc)
virtual void close (ACS::CBvoid_ptr cb, const ACS::CBDescIn &desc)
virtual void move (CORBA::Double pos)
virtual ACS::ROdouble_ptr position ()
virtual ACS::RWdouble_ptr ref_position ()
virtual ACS::ROlong_ptr substate ()
virtual ACS::ROstring_ptr version ()
virtual void execute ()

Private Member Functions

virtual void checkSubstate (CompletionImpl *&error_p)
void operator= (const Door &)

Private Attributes

baci::SmartPropertyPointer<
baci::RWdouble
m_ref_position_sp
baci::SmartPropertyPointer<
baci::ROdouble
m_position_sp
baci::SmartPropertyPointer<
baci::ROlong
m_substate_sp
baci::SmartPropertyPointer<
baci::ROstring
m_version_sp
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:


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

virtual Door::~Door  )  [virtual]
 

Destructor


Member Function Documentation

virtual 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

virtual 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

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


virtual 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

Reimplemented from acscomponent::ACSComponentImpl.

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


Implements baci::ActionImplementator.

virtual 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

virtual 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

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


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

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

virtual 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

virtual 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

virtual 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

virtual 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


Friends And Related Function Documentation

void DoorThread::runLoop  )  [friend]
 


Member Data Documentation

DoorThread* Door::m_doorThread_p [private]
 

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

m_position_sp is the Door's actual position

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

m_ref_position_sp is the position the Door should be in

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

m_substate_sp is the state the door is currently in

See also:
acsexmplDoorImpl.cpp

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

m_version_sp is the Door's current version


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