diff options
Diffstat (limited to 'cpp/test/Ice/background/PluginI.cpp')
-rw-r--r-- | cpp/test/Ice/background/PluginI.cpp | 86 |
1 files changed, 86 insertions, 0 deletions
diff --git a/cpp/test/Ice/background/PluginI.cpp b/cpp/test/Ice/background/PluginI.cpp new file mode 100644 index 00000000000..a00c0208482 --- /dev/null +++ b/cpp/test/Ice/background/PluginI.cpp @@ -0,0 +1,86 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2007 ZeroC, Inc. All rights reserved. +// +// This copy of Ice is licensed to you under the terms described in the +// ICE_LICENSE file included in this distribution. +// +// ********************************************************************** + +#include <Ice/Initialize.h> +#include <Ice/Instance.h> +#include <Ice/ProtocolPluginFacade.h> +#include <Ice/EndpointFactoryManager.h> + +#include <PluginI.h> +#include <EndpointFactory.h> + +#ifndef TEST_TRANSPORT_API +# define TEST_TRANSPORT_API ICE_DECLSPEC_EXPORT +#endif + +using namespace std; + +class TestPluginI : public PluginI +{ +public: + + TestPluginI(const Ice::CommunicatorPtr&); + + virtual void initialize(); + virtual void destroy(); + + virtual ConfigurationPtr getConfiguration(); + +private: + + const Ice::CommunicatorPtr _communicator; + const ConfigurationPtr _configuration; +}; + + +// +// Plugin factory function. +// +extern "C" +{ + +TEST_TRANSPORT_API Ice::Plugin* +createTestTransport(const Ice::CommunicatorPtr& communicator, const string& name, const Ice::StringSeq& args) +{ + return new TestPluginI(communicator); +} + +} + +TestPluginI::TestPluginI(const Ice::CommunicatorPtr& communicator) : + _communicator(communicator), + _configuration(new Configuration()) +{ +} + +void +TestPluginI::initialize() +{ + IceInternal::ProtocolPluginFacadePtr facade = IceInternal::getProtocolPluginFacade(_communicator); + + for(Ice::Short s = 0; s < 100; ++s) + { + IceInternal::EndpointFactoryPtr factory = facade->getEndpointFactory(s); + if(factory) + { + facade->addEndpointFactory(new EndpointFactory(factory)); + } + } +} + +void +TestPluginI::destroy() +{ +} + +ConfigurationPtr +TestPluginI::getConfiguration() +{ + return _configuration; +} |