diff options
Diffstat (limited to 'cpp/demo/IcePack/hello/HelloServiceI.cpp')
-rw-r--r-- | cpp/demo/IcePack/hello/HelloServiceI.cpp | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/cpp/demo/IcePack/hello/HelloServiceI.cpp b/cpp/demo/IcePack/hello/HelloServiceI.cpp new file mode 100644 index 00000000000..c1f32a60d95 --- /dev/null +++ b/cpp/demo/IcePack/hello/HelloServiceI.cpp @@ -0,0 +1,61 @@ +// ********************************************************************** +// +// Copyright (c) 2002 +// ZeroC, Inc. +// Huntsville, AL, USA +// +// All Rights Reserved. +// +// Ice is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License version 2 as published by +// the Free Software Foundation. +// +// ********************************************************************** + +#include <Ice/Ice.h> +#include <HelloServiceI.h> +#include <HelloI.h> + +using namespace std; + +extern "C" +{ + +// +// Factory function +// +HELLO_API ::IceBox::Service* +create(::Ice::CommunicatorPtr communicator) +{ + return new HelloServiceI; +} + +} + +HelloServiceI::HelloServiceI() +{ +} + +HelloServiceI::~HelloServiceI() +{ +} + +void +HelloServiceI::start(const string& name, + const ::Ice::CommunicatorPtr& communicator, + const ::Ice::StringSeq& args) +{ + _adapter = communicator->createObjectAdapter("Hello"); + + string id = communicator->getProperties()->getProperty("Identity"); + + Ice::ObjectPtr object = new HelloFactoryI(); + _adapter->add(object, Ice::stringToIdentity(id)); + _adapter->activate(); +} + +void +HelloServiceI::stop() +{ + _adapter->deactivate(); +} |