Download presentation
Presentation is loading. Please wait.
1
BACI Properties Mount2 example
Bogdan Jeram European Southern Observatory July 2005 ESO
2
Properties in IDL properties are defined in baci.idl (we have to include it!) introduced in component interface as IDL readonly attributes component interface has to derive from: ACS::CharacteristicComponent ACS Course Tokyo, July 2005 Running ACS
3
Mount2 IDL interface Mount2 : ACS::CharacteristicComponent { void objfix (in double az, in double elev); readonly attribute ACS::RWdouble cmdAz; readonly attribute ACS::RWdouble cmdEl; readonly attribute ACS::ROdouble actAz; readonly attribute ACS::ROdouble actEl; }; ACS Course Tokyo, July 2005 Running ACS
4
Properties in C++ Implemented in baci library
header file per property type. Example: baciROdouble.h baciRWdouble.h baciROpattern.h ACS Course Tokyo, July 2005 Running ACS
5
Component header file includes: #include <baciCharacteristicComponentImpl.h> header file for each property type Examples: #include <baciROdouble.h> #include <baciRWdouble.h> Namespace: baci (using namespace baci) ACS Course Tokyo, July 2005 Running ACS
6
Component header file Class implementation has to inherit:
CharacteriticComponentImpl (common functionality) from idl generated skeleton: POA_ACSCOURSE_MOUNT::Mount1 constructor: with 2 parameters: Mount2Impl( const ACE_CString &name, maci::ContainerServices *containerServices); Member for each property. Examples: SmartPropertyPointer<RWdouble> m_cmdAz_sp; SmartPropertyPointer<ROdouble> m_actAz_sp; Accessor methods. Examples: ACS::RWdouble_ptr cmdEl () throw (CORBA::SystemException); ACS::ROdouble_ptr actAz () throw (CORBA::SystemException); ACS Course Tokyo, July 2005 Running ACS
7
Component Implementation
#include <acscourseMount2Impl.h> #include <iostream> using namespace std; Mount2Impl::Mount2Impl( const ACE_CString &_name, maci::ContainerServices *containerServices) : CharacteristicComponentImpl(_name, containerServices), m_cmdAz_sp(new RWdouble(_name+":cmdAz", getComponent()),this), m_cmdEl_sp(new RWdouble(_name+":cmdEl", getComponent()),this), m_actAz_sp(new ROdouble(_name+":actAz", getComponent()),this), m_actEl_sp(new ROdouble(_name+":actEl", getComponent()),this) { ACS_TRACE("::Mount2Impl::Mount2Impl"); } Mount2Impl::~Mount2Impl() { purposes ACS_TRACE("::Mount2Impl::~Mount2Impl"); ACS Course Tokyo, July 2005 Running ACS
8
Accessor methods implementation
returns “property” ACS::RWdouble_ptr Mount2Impl::cmdAz () throw (CORBA::SystemException) { if (m_cmdAz_sp == 0) return ACS::RWdouble::_nil(); } ACS::RWdouble_var prop = ACS::RWdouble::_narrow(m_cmdAz_sp->getCORBAReference()); return prop._retn(); ACS Course Tokyo, July 2005 Running ACS
9
Functional methods implementation
void Mount2Impl::objfix (CORBA::Double az, CORBA::Double elev) throw (CORBA::SystemException) { ACS_TRACE("::Mount2Impl::objfix"); unsigned long long timestamp; m_cmdAz_sp->getDevIO()->write(az, timestamp); m_cmdEl_sp->getDevIO()->write(elev, timestamp); ACS_SHORT_LOG((LM_INFO,"Received objfix command. Az: %f El: %f", az, elev)); } ACS Course Tokyo, July 2005 Running ACS
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.