diff options
author | Marc Laukien <marc@zeroc.com> | 2001-08-14 11:52:47 +0000 |
---|---|---|
committer | Marc Laukien <marc@zeroc.com> | 2001-08-14 11:52:47 +0000 |
commit | 91a394a09d9684d20cfa4c941cebb6b3579b9666 (patch) | |
tree | eb99bdac118a23814e1dfcd8d4e5fc64a9c8f0cc /cpp/src/Ice/ProxyFactory.cpp | |
parent | locator (diff) | |
download | ice-91a394a09d9684d20cfa4c941cebb6b3579b9666.tar.bz2 ice-91a394a09d9684d20cfa4c941cebb6b3579b9666.tar.xz ice-91a394a09d9684d20cfa4c941cebb6b3579b9666.zip |
changed directory structure
Diffstat (limited to 'cpp/src/Ice/ProxyFactory.cpp')
-rw-r--r-- | cpp/src/Ice/ProxyFactory.cpp | 78 |
1 files changed, 78 insertions, 0 deletions
diff --git a/cpp/src/Ice/ProxyFactory.cpp b/cpp/src/Ice/ProxyFactory.cpp new file mode 100644 index 00000000000..d15f7debb7b --- /dev/null +++ b/cpp/src/Ice/ProxyFactory.cpp @@ -0,0 +1,78 @@ +// ********************************************************************** +// +// Copyright (c) 2001 +// MutableRealms, Inc. +// Huntsville, AL, USA +// +// All Rights Reserved +// +// ********************************************************************** + +#include <Ice/ProxyFactory.h> +#include <Ice/Instance.h> +#include <Ice/Proxy.h> +#include <Ice/Reference.h> +#include <Ice/Endpoint.h> +#include <Ice/Stream.h> + +using namespace std; +using namespace Ice; +using namespace IceInternal; + +void IceInternal::incRef(ProxyFactory* p) { p->__incRef(); } +void IceInternal::decRef(ProxyFactory* p) { p->__decRef(); } + +ObjectPrx +IceInternal::ProxyFactory::stringToProxy(const string& s) +{ + ReferencePtr reference = new Reference(_instance, s); + return referenceToProxy(reference); +} + +ObjectPrx +IceInternal::ProxyFactory::streamToProxy(Stream* s) +{ + Stream::Container::iterator i = s->i; + string identity; + s->read(identity); + if (identity.length() == 0) + { + return 0; + } + else + { + s->i = i; + ReferencePtr reference = new Reference(s); + return referenceToProxy(reference); + } +} + +ObjectPrx +IceInternal::ProxyFactory::referenceToProxy(const ReferencePtr& reference) +{ + ObjectPrx proxy = new ::IceProxy::Ice::Object; + proxy->setup(reference); + return proxy; +} + +void +IceInternal::ProxyFactory::proxyToStream(const ObjectPrx& proxy, Stream* s) +{ + if (proxy) + { + proxy->__reference()->streamWrite(s); + } + else + { + s->write(""); + } +} + +IceInternal::ProxyFactory::ProxyFactory(const InstancePtr& instance) + : _instance(instance) +{ +} + +IceInternal::ProxyFactory::~ProxyFactory() +{ +} |