summaryrefslogtreecommitdiff
path: root/cpp/src/slice2cpp/Gen.cpp
diff options
context:
space:
mode:
authorBernard Normier <bernard@zeroc.com>2007-10-02 11:48:54 -0400
committerBernard Normier <bernard@zeroc.com>2007-10-02 11:48:54 -0400
commit2cb718a85b417fb6a58be04fe1f102f733b8d39c (patch)
tree26549f37c7307037f0bf8bf0d42b6c1da7eaeb4b /cpp/src/slice2cpp/Gen.cpp
parentFixed bug 2503 (diff)
downloadice-2cb718a85b417fb6a58be04fe1f102f733b8d39c.tar.bz2
ice-2cb718a85b417fb6a58be04fe1f102f733b8d39c.tar.xz
ice-2cb718a85b417fb6a58be04fe1f102f733b8d39c.zip
Squashed commit of the following:
commit 0ba15449d9dd44933d82cb643efded9dee12c5af Author: Bernard Normier <bernard@zeroc.com> Date: Tue Oct 2 11:48:07 2007 -0400 Documented updates commit cf49ee5a73bc62d1b6814dec5d9f288f0f45901d Author: Bernard Normier <bernard@zeroc.com> Date: Tue Oct 2 11:38:25 2007 -0400 Optimized implementation of various Prx ice_xxx functions/methods commit 706209d6d1a4e894fecf19dd1c0c3b6f12ef5842 Author: Bernard Normier <bernard@zeroc.com> Date: Fri Sep 28 14:34:02 2007 -0400 Updated code-generation to "overwrite" various Ice::ObjectPrx ice_ operations.
Diffstat (limited to 'cpp/src/slice2cpp/Gen.cpp')
-rw-r--r--cpp/src/slice2cpp/Gen.cpp120
1 files changed, 120 insertions, 0 deletions
diff --git a/cpp/src/slice2cpp/Gen.cpp b/cpp/src/slice2cpp/Gen.cpp
index 0d70727d44f..ebafdf80e5b 100644
--- a/cpp/src/slice2cpp/Gen.cpp
+++ b/cpp/src/slice2cpp/Gen.cpp
@@ -1778,9 +1778,123 @@ Slice::Gen::ProxyVisitor::visitClassDefStart(const ClassDefPtr& p)
void
Slice::Gen::ProxyVisitor::visitClassDefEnd(const ClassDefPtr& p)
{
+ string name = fixKwd(p->name());
string scoped = fixKwd(p->scoped());
string scope = fixKwd(p->scope());
+
+ //
+ // "Overwrite" various non-virtual functions in ::IceProxy::Ice::Object that return an ObjectPrx and
+ // are more usable when they return a <name>Prx
+ //
+
+ //
+ // No identity!
+ //
+
+ H << nl << nl << "::IceInternal::ProxyHandle<" << name << "> ice_context(const ::Ice::Context& __context) const";
+ H << sb;
+ H << nl << "return dynamic_cast<" << name << "*>(::IceProxy::Ice::Object::ice_context(__context).get());";
+ H << eb;
+
+ //
+ // No facet!
+ //
+
+ H << nl << nl << "::IceInternal::ProxyHandle<" << name << "> ice_adapterId(const std::string& __id) const";
+ H << sb;
+ H << nl << "return dynamic_cast<" << name << "*>(::IceProxy::Ice::Object::ice_adapterId(__id).get());";
+ H << eb;
+
+ H << nl << nl << "::IceInternal::ProxyHandle<" << name << "> ice_endpoints(const ::Ice::EndpointSeq& __endpoints) const";
+ H << sb;
+ H << nl << "return dynamic_cast<" << name << "*>(::IceProxy::Ice::Object::ice_endpoints(__endpoints).get());";
+ H << eb;
+
+ H << nl << nl << "::IceInternal::ProxyHandle<" << name << "> ice_locatorCacheTimeout(int __timeout) const";
+ H << sb;
+ H << nl << "return dynamic_cast<" << name << "*>(::IceProxy::Ice::Object::ice_locatorCacheTimeout(__timeout).get());";
+ H << eb;
+
+ H << nl << nl << "::IceInternal::ProxyHandle<" << name << "> ice_connectionCached(bool __cached) const";
+ H << sb;
+ H << nl << "return dynamic_cast<" << name << "*>(::IceProxy::Ice::Object::ice_connectionCached(__cached).get());";
+ H << eb;
+
+ H << nl << nl << "::IceInternal::ProxyHandle<" << name << "> ice_endpointSelection(::Ice::EndpointSelectionType __est) const";
+ H << sb;
+ H << nl << "return dynamic_cast<" << name << "*>(::IceProxy::Ice::Object::ice_endpointSelection(__est).get());";
+ H << eb;
+
+ H << nl << nl << "::IceInternal::ProxyHandle<" << name << "> ice_secure(bool __secure) const";
+ H << sb;
+ H << nl << "return dynamic_cast<" << name << "*>(::IceProxy::Ice::Object::ice_secure(__secure).get());";
+ H << eb;
+
+ H << nl << nl << "::IceInternal::ProxyHandle<" << name << "> ice_preferSecure(bool __preferSecure) const";
+ H << sb;
+ H << nl << "return dynamic_cast<" << name << "*>(::IceProxy::Ice::Object::ice_preferSecure(__preferSecure).get());";
+ H << eb;
+
+ H << nl << nl << "::IceInternal::ProxyHandle<" << name << "> ice_router(const ::Ice::RouterPrx& __router) const";
+ H << sb;
+ H << nl << "return dynamic_cast<" << name << "*>(::IceProxy::Ice::Object::ice_router(__router).get());";
+ H << eb;
+
+ H << nl << nl << "::IceInternal::ProxyHandle<" << name << "> ice_locator(const ::Ice::LocatorPrx& __locator) const";
+ H << sb;
+ H << nl << "return dynamic_cast<" << name << "*>(::IceProxy::Ice::Object::ice_locator(__locator).get());";
+ H << eb;
+
+ H << nl << nl << "::IceInternal::ProxyHandle<" << name << "> ice_collocationOptimized(bool __co) const";
+ H << sb;
+ H << nl << "return dynamic_cast<" << name << "*>(::IceProxy::Ice::Object::ice_collocationOptimized(__co).get());";
+ H << eb;
+
+ H << nl << nl << "::IceInternal::ProxyHandle<" << name << "> ice_twoway() const";
+ H << sb;
+ H << nl << "return dynamic_cast<" << name << "*>(::IceProxy::Ice::Object::ice_twoway().get());";
+ H << eb;
+
+ H << nl << nl << "::IceInternal::ProxyHandle<" << name << "> ice_oneway() const";
+ H << sb;
+ H << nl << "return dynamic_cast<" << name << "*>(::IceProxy::Ice::Object::ice_oneway().get());";
+ H << eb;
+
+ H << nl << nl << "::IceInternal::ProxyHandle<" << name << "> ice_batchOneway() const";
+ H << sb;
+ H << nl << "return dynamic_cast<" << name << "*>(::IceProxy::Ice::Object::ice_batchOneway().get());";
+ H << eb;
+
+ H << nl << nl << "::IceInternal::ProxyHandle<" << name << "> ice_datagram() const";
+ H << sb;
+ H << nl << "return dynamic_cast<" << name << "*>(::IceProxy::Ice::Object::ice_datagram().get());";
+ H << eb;
+
+ H << nl << nl << "::IceInternal::ProxyHandle<" << name << "> ice_batchDatagram() const";
+ H << sb;
+ H << nl << "return dynamic_cast<" << name << "*>(::IceProxy::Ice::Object::ice_batchDatagram().get());";
+ H << eb;
+
+ H << nl << nl << "::IceInternal::ProxyHandle<" << name << "> ice_compress(bool __compress) const";
+ H << sb;
+ H << nl << "return dynamic_cast<" << name << "*>(::IceProxy::Ice::Object::ice_compress(__compress).get());";
+ H << eb;
+
+ H << nl << nl << "::IceInternal::ProxyHandle<" << name << "> ice_timeout(int __timeout) const";
+ H << sb;
+ H << nl << "return dynamic_cast<" << name << "*>(::IceProxy::Ice::Object::ice_timeout(__timeout).get());";
+ H << eb;
+
+ H << nl << nl << "::IceInternal::ProxyHandle<" << name << "> ice_connectionId(const std::string& __id) const";
+ H << sb;
+ H << nl << "return dynamic_cast<" << name << "*>(::IceProxy::Ice::Object::ice_connectionId(__id).get());";
+ H << eb;
+ H << nl << nl << "::IceInternal::ProxyHandle<" << name << "> ice_threadPerConnection(bool __tpc) const";
+ H << sb;
+ H << nl << "return dynamic_cast<" << name << "*>(::IceProxy::Ice::Object::ice_threadPerConnection(__tpc).get());";
+ H << eb;
+
H << nl << nl << _dllExport << "static const ::std::string& ice_staticId();";
H.dec();
@@ -1788,6 +1902,7 @@ Slice::Gen::ProxyVisitor::visitClassDefEnd(const ClassDefPtr& p)
H.inc();
H << sp << nl << _dllExport << "virtual ::IceInternal::Handle< ::IceDelegateM::Ice::Object> __createDelegateM();";
H << nl << _dllExport << "virtual ::IceInternal::Handle< ::IceDelegateD::Ice::Object> __createDelegateD();";
+ H << nl << _dllExport << "virtual ::IceProxy::Ice::Object* __newInstance() const;";
H << eb << ';';
C << sp;
@@ -1806,6 +1921,11 @@ Slice::Gen::ProxyVisitor::visitClassDefEnd(const ClassDefPtr& p)
C << sb;
C << nl << "return ::IceInternal::Handle< ::IceDelegateD::Ice::Object>(new ::IceDelegateD" << scoped << ");";
C << eb;
+ C << sp << nl << "::IceProxy::Ice::Object*";
+ C << nl << "IceProxy" << scoped << "::__newInstance() const";
+ C << sb;
+ C << nl << "return new " << name << ";";
+ C << eb;
_useWstring = resetUseWstring(_useWstringHist);
}