Articles     Forum     Examples     Download     Open Source

 

PocoCapsule/C++ example: GPS in DSM

Copyright(c) 2006 by Pocomatic Software. All rights reserved.

This example was originated from a OMG's tutorial for CORBA Component Model (CCM). It models a GPS instrument consists of the following three components implemented as Plain Old C++ objects (POCO) as illustrated in the diagram below:


These three components (beans) are instantiated, configured and wired up inside a PocoCapsule/C++ IoC container as described by the deployment descriptor setup.xml in an user defined "domain-specific-modeling" (DSM) schema. The same example deployed in the core schema of PocoCapsule/C++ IoC (namely poco-application-context) can be found in the ${POCOCAPSULE_DIR}/examples/corba/gps directory.

Source Files

main.C: This is a simple container, used to assemble the GPS application context. It is notable that this container itself is completely decoupled with application bean implementations. It does not include/use their source code, nor link with their binaries.

Interfaces.h: C++ interfaces (as pure virtual C++ classes) definitions of component beans. Note: an equivalent CORBA version of this example, that uses IDL to define component interfaces, can be found in the ${POCOCAPSULE_DIR}/examples/corba/gps directory.

TickGenImpl.h and TickGenImpl.C: The implementation of tick generator device bean class.

GPSLocatorImpl.h and GPSLocatorImpl.C: The implementation of GPS locator device bean class.

NavDisplayImpl.h and NavDisplayImpl.C: The implementation of Navigate Display device bean class. It is also notable that above three application implementation POCO beans themselves are container agnostic. It does not use, nor link with PocoCapsule/C++ container runtime engine. They are plain old C++ objects can be developed and tested completely independent of and unaware of PocoCapsule/C++ container.

setup.xml: The deployment description file that uses a DSM schema to describes the setup of the modeled GPS application.

gps-device.dtd: The document type definition of the user defined DSM schema.

gps-device2poco.xsl: The user defined gps-device DSM schema to PocoCapsule/C++ core schema transformation stylesheet.

Building this example

To build this example, the environment variable POCOCAPSULE_DIR should point to the PocoCapsule/C++ installed directory. Then, this example can be built by simply invoking gmake/make on linux/unix or nmake on windows.

Running this example

· Before starting the application deployment container (i.e. the main executable), make sure the LD_LIBRARY_PATH (on linux and solaris) or the PATH (on windows) environment variable is set correctly to include the ${POCOCAPSULE_DIR}/lib directory.

· start the main executable:

prompt> main 

It will display GPS locations ...

Back to the root page