1 / 18

ACS Training

ACS Training. Developing a C++ Component. Getting Started with ACS Course and ACS Example. At the console, type: cvs co ACS/LGPL/CommonSoftware/acscourse This gives you the latest version of the ACS Course module. And cvs co ACS/LGPL/CommonSoftware/acsexample

cwen
Download Presentation

ACS Training

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. ACS Training Developing a C++ Component

  2. Getting Started with ACS Course and ACS Example At the console, type: cvs co ACS/LGPL/CommonSoftware/acscourse This gives you the latest version of the ACS Course module. And cvs co ACS/LGPL/CommonSoftware/acsexample This gives you the latest version of the ACS Example module containing C++ examples for ACS. ACS Training

  3. What files need to be created? • IDL (Interface Definition Language) File(s) • Specifies object methods that are useful to clients. • Specifies object members that can be manipulated by clients. • Good place to describe data structures that will be used by multiple programming languages. ACS Training

  4. What files needs to be created? (continued) • C++ Implementation Files • Implementation of the IDL to C++ CORBA mapping. • What actually ends up invoking clients calls. • Normally consists of one header file and one implementation file. ACS Training

  5. What files needs to be created(continued)? • Components.xml (deployment information) • Defines the name, IDL type, implementation code (shared library in C++), and Container where the Component instance will run. ACS Training

  6. Sample IDL Interface ACS/LGPL/CommonSoftware/acscourse/ws/idl/acscourseMount.idl #ifndef _ACSCOURSE_MOUNT_IDL_ #define _ACSCOURSE_MOUNT_IDL_ #include <acscomponent.idl> #pragma prefix "alma" module ACSCOURSE_MOUNT { interface Mount1 : ACS::ACSComponent { voidobjfix (in doubleaz, in doubleelev) raises (ACSErrTypeACSCourse::TargetNotFoundEx); }; }; #endif ACS Training

  7. High-level ACS C++ Concepts • For each method in the IDL, there exists exactly one C++ method of the same name. • For every IDL attribute, there is one method of the same name used to access that IDL attribute and one C++ member variable (which can be named almost anything). ACS Training

  8. Sample C++ Implementation Header #ifndef acscourseMount1Impl_h #define acscourseMount1Impl_h #ifndef __cplusplus #error This is a C++ include file and cannot be used from plain C #endif #include <acscomponentImpl.h> #include <acscourseMountS.h> using namespace acscomponent; class Mount1Impl: public virtual ACSComponentImpl, public virtual POA_ACSCOURSE_MOUNT::Mount1 { public: Mount1Impl(const ACE_CString &name, maci::ContainerServices *containerServices); virtual ~Mount1Impl(); ACS Training

  9. Sample C++ Implementation Header (continued) virtual void objfix (CORBA::Double az, CORBA::Double elev) throw (CORBA::SystemException); private: void operator=(const Mount1Impl&); }; #endif /*!acscourseMount1Impl_H*/ ACS Training

  10. Other C++ Headers acsexmpl/ws/include/*Impl.h ACS Training

  11. Sample C++ Implementation #include <acscourseMount1Impl.h> #include <iostream> using namespace std; Mount1Impl::Mount1Impl(const ACE_CString &name, maci::ContainerServices *containerServices) : acscomponent::ACSComponentImpl(name, containerServices) { // ACS_TRACE is used for debugging purposes ACS_TRACE("::Mount1Impl::Mount1Impl"); } Mount1Impl::~Mount1Impl() { ACS_TRACE("::Mount1Impl::~Mount1Impl"); ACS_DEBUG_PARAM("::Mount1Impl::~Mount1Impl", "Destroying %s...", name()); } ACS Training

  12. Sample C++ Implementation(continued) void Mount1Impl::objfix (CORBA::Double az, CORBA::Double elev) throw (CORBA::SystemException) { cout << "Received objfix command. Az: " << az << " El: " << elev << endl; } #include <maciACSComponentDefines.h> MACI_DLL_SUPPORT_FUNCTIONS(Mount1Impl) /*___oOo___*/ ACS Training

  13. Other C++ Implementations acsexmpl/ws/src/*Impl.cpp ACS Training

  14. CDB/MACI/COBs/COBs.xml <?xml version="1.0" encoding="utf-8"?> <Components xmlns="urn:schemas-cosylab-com:Components:1.0" xmlns:cdb="urn:schemas-cosylab-com:CDB:1.0" xmlns:baci="urn:schemas-cosylab-com:BACI:1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <_ Name="MOUNT1_01" Code="acscourseMount1Impl" Type="IDL:alma/ACSCOURSE_MOUNT/Mount1:1.0“ Container=“bilboContainer”> </Components> ACS Training

  15. Other Files involving the CDB acsexmpl/ws/test/CDB/* ACS Training

  16. C++ Implementation Diagram IDL C++ Stub C++ Skeleton Implementation “DLL” Library (*.h, *.cpp) ACS ACS Training

  17. Questions about Component’s implementation in CPP??? ACS Training

  18. Demo(s)??? ACS Training

More Related