1 / 9

BACI Properties Mount2 example

BACI Properties Mount2 example. Bogdan Jeram (bjeram@eso.org) European Southern Observatory. July 2005. ESO. Properties in IDL. properties are defined in baci.idl (we have to include it!) introduced in component interface as IDL readonly attributes

lamont
Download Presentation

BACI Properties Mount2 example

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. BACI PropertiesMount2 example Bogdan Jeram (bjeram@eso.org) 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 Running ACS

  3. Mount2 IDL http://websqa.hq.eso.org/bin/viewcvs.cgi/ACS/LGPL/CommonSoftware/acscourse/ws/idl/acscourseMount.idl?rev=HEAD&content-type=text/vnd.viewcvs-markup 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; }; Running ACS

  4. Properties in C++ • Implemented in baci library • header file per property type. Example: baciROdouble.h baciRWdouble.h baciROpattern.h Running ACS

  5. Component header file http://websqa.hq.eso.org/bin/viewcvs.cgi/ACS/LGPL/CommonSoftware/acscourse/ws/include/acscourseMount2Impl.h?rev=HEAD&content-type=text/vnd.viewcvs-markup includes: #include <baciCharacteristicComponentImpl.h> header file for each property type Examples: #include <baciROdouble.h> #include <baciRWdouble.h> Namespace: baci(using namespace baci) 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); Running ACS

  7. Component Implementation http://websqa.hq.eso.org/bin/viewcvs.cgi/ACS/LGPL/CommonSoftware/acscourse/ws/src/acscourseMount2Impl.cpp?rev=HEAD&content-type=text/vnd.viewcvs-markup #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"); } 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(); } 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)); } Running ACS

More Related