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

Door Class Reference

#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 ActionRequest invokeAction (int function, BACIComponent *component_p, const int &callbackID, const CBDescIn &descIn, BACIValue *value_p, Completion &completion, CBDescOut &descOut)
virtual ActionRequest openAction (BACIComponent *component_p, const int &callbackID, const CBDescIn &descIn, BACIValue *value_p, Completion &completion, CBDescOut &descOut)
virtual ActionRequest closeAction (BACIComponent *component_p, const int &callbackID, const CBDescIn &descIn, BACIValue *value_p, Completion &completion, CBDescOut &descOut)
virtual void open (ACS::CBvoid_ptr cb, const ACS::CBDescIn &desc) throw (CORBA::SystemException)
virtual void close (ACS::CBvoid_ptr cb, const ACS::CBDescIn &desc) throw (CORBA::SystemException)
virtual void move (CORBA::Double pos) throw (CORBA::SystemException)
virtual ACS::ROdouble_ptr position () throw (CORBA::SystemException)
virtual ACS::RWdouble_ptr ref_position () throw (CORBA::SystemException)
virtual ACS::ROlong_ptr substate () throw (CORBA::SystemException)
virtual ACS::ROstring_ptr version () throw (CORBA::SystemException)
virtual void execute () throw (ACSErr::ACSbaseExImpl)

Private Member Functions

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

Private Attributes

SmartPropertyPointer< RWdoublem_ref_position_sp
SmartPropertyPointer< ROdoublem_position_sp
SmartPropertyPointer< ROlongm_substate_sp
SmartPropertyPointer< ROstringm_version_sp
DoorThreadm_doorThread_p

Friends

void DoorThread::runLoop ()

Detailed Description

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
throw (CORBA::SystemException) [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 ActionRequest Door::closeAction BACIComponent *  component_p,
const int &  callbackID,
const CBDescIn descIn,
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 Callback::working
  • reqInvokeDone - invoke Callback::done and destroy callback
  • reqDestroy - destroy callback (callback should has been called already by function)


virtual void Door::execute  )  throw (ACSErr::ACSbaseExImpl) [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

Reimplemented from acscomponent::ACSComponentImpl.

virtual ActionRequest Door::invokeAction int  function,
BACIComponent *  component_p,
const int &  callbackID,
const CBDescIn descIn,
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 Callback::working
  • reqInvokeDone - invoke 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  )  throw (CORBA::SystemException) [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
throw (CORBA::SystemException) [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 ActionRequest Door::openAction BACIComponent *  component_p,
const int &  callbackID,
const CBDescIn descIn,
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 Callback::working
  • reqInvokeDone - invoke 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  )  throw (CORBA::SystemException) [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  )  throw (CORBA::SystemException) [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  )  throw (CORBA::SystemException) [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  )  throw (CORBA::SystemException) [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]
 

SmartPropertyPointer<ROdouble> Door::m_position_sp [private]
 

m_position_sp is the Door's actual position

SmartPropertyPointer<RWdouble> Door::m_ref_position_sp [private]
 

m_ref_position_sp is the position the Door should be in

SmartPropertyPointer<ROlong> Door::m_substate_sp [private]
 

m_substate_sp is the state the door is currently in

See also:
acsexmplDoorImpl.cpp

SmartPropertyPointer<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 Sun Oct 29 02:30:50 2006 for ACS C++ API by doxygen 1.3.6