Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagepy
titlecppHelloComp/include/HelloComponentImpl.h
#ifndef _HELLO_COMPONENT_IMPL_H
#define _HELLO_COMPONENT_IMPL_H
 
#ifndef __cplusplus
#error This is a C++ include file and cannot be used from plain C
#endif
 
//Base component implementation, including container services and component lifecycle infrastructure
#include <acscomponentImpl.h>
 
//Skeleton interface for server implementation
#include <HelloComponentS.h>
 
//Error definitions for catching and raising exceptions
class HelloComponentImpl : public virtual acscomponent::ACSComponentImpl, public virtual POA_workshop::HelloComponent {
  public:
    HelloComponentImpl(const ACE_CString& name, maci::ContainerServices * containerServices);
    virtual ~HelloComponentImpl();
    char* printHello();
};
 
#endif
Code Block
languagebash
vim HelloComponentImpl.cpp
Code Block
languagecpp
titlecppHelloComp/src/HelloComponentImpl.cpp
#include <HelloComponentImpl.h>
 
HelloComponentImpl::HelloComponentImpl(const ACE_CString& name, maci::ContainerServices * containerServices) : ACSComponentImpl(name, containerServices) {
}
 
HelloComponentImpl::~HelloComponentImpl() {
}
 
char* HelloComponentImpl::printHello() {
    std::cout << "Just printing 'Hello World!'" << std::endl;
    return CORBA::string_dup("Hello World!");
}
 
/* --------------- [ MACI DLL support functions ] -----------------*/
#include <maciACSComponentDefines.h>
MACI_DLL_SUPPORT_FUNCTIONS(HelloComponentImpl)
/* ----------------------------------------------------------------*/

Compile component

Code Block
languagebash
export INTROOT=~/workspace/introot
export LD_LIBRARY_PATH=$INTROOT/lib:$LD_LIBRARY_PATH
make all install

...