diff options
Diffstat (limited to 'cpp/demo/IceBox/hello/HelloServiceI.cpp')
-rw-r--r-- | cpp/demo/IceBox/hello/HelloServiceI.cpp | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/cpp/demo/IceBox/hello/HelloServiceI.cpp b/cpp/demo/IceBox/hello/HelloServiceI.cpp new file mode 100644 index 00000000000..b7596d539e2 --- /dev/null +++ b/cpp/demo/IceBox/hello/HelloServiceI.cpp @@ -0,0 +1,54 @@ +#include <Ice/Ice.h> +#include <HelloServiceI.h> +#include <HelloI.h> + +using namespace std; + +extern "C" +{ + +// +// Factory function +// +::IceBox::ServicePtr +create(::Ice::CommunicatorPtr communicator) +{ + return new HelloServiceI; +} + +} + +HelloServiceI::HelloServiceI() +{ + cout << "HelloServiceI()" << endl; +} + +HelloServiceI::~HelloServiceI() +{ + cout << "~HelloServiceI()" << endl; +} + +void +HelloServiceI::init(const string& name, + const ::Ice::CommunicatorPtr& communicator, + const ::Ice::PropertiesPtr& properties, + const ::Ice::StringSeq& args) +{ + _adapter = communicator->createObjectAdapter(name + "Adapter"); + ::Ice::ObjectPtr object = new HelloI(communicator); + _adapter->add(object, ::Ice::stringToIdentity("hello")); + _adapter->activate(); +} + +void +HelloServiceI::start() +{ + cout << "HelloServiceI::start" << endl; +} + +void +HelloServiceI::stop() +{ + cout << "HelloServiceI::stop" << endl; + _adapter->deactivate(); +} |