diff options
-rw-r--r-- | cpp/src/slice2cppe/Gen.cpp | 291 | ||||
-rw-r--r-- | cpp/src/slice2cppe/Gen.h | 22 | ||||
-rw-r--r-- | cppe/include/IceE/Config.h | 2 | ||||
-rw-r--r-- | cppe/include/IceE/Proxy.h | 40 | ||||
-rw-r--r-- | cppe/include/IceE/ProxyF.h | 15 | ||||
-rw-r--r-- | cppe/src/IceE/Proxy.cpp | 590 | ||||
-rw-r--r-- | cppe/src/TcpTransport/Transceiver.cpp | 2 |
7 files changed, 311 insertions, 651 deletions
diff --git a/cpp/src/slice2cppe/Gen.cpp b/cpp/src/slice2cppe/Gen.cpp index 3c50f18fcb5..85e3d119727 100644 --- a/cpp/src/slice2cppe/Gen.cpp +++ b/cpp/src/slice2cppe/Gen.cpp @@ -283,9 +283,6 @@ Slice::Gen::generate(const UnitPtr& p) ProxyVisitor proxyVisitor(H, C, _dllExport); p->visit(&proxyVisitor, false); - DelegateVisitor delegateVisitor(H, C, _dllExport); - p->visit(&delegateVisitor, false); - if(_impl) { implH << "\n#include <"; @@ -1316,11 +1313,6 @@ Slice::Gen::ProxyVisitor::visitClassDefEnd(const ClassDefPtr& p) string scope = fixKwd(p->scope()); H << nl << nl << "static const ::std::string& ice_staticId();"; - - H.dec(); - H << sp << nl << "private: "; - H.inc(); - H << sp << nl << "virtual ::IceInternal::Handle< ::IceDelegate::Ice::Object> __createDelegate();"; H << eb << ';'; string flatName = p->flattenedScope() + p->name() + "_ids"; @@ -1339,12 +1331,6 @@ Slice::Gen::ProxyVisitor::visitClassDefEnd(const ClassDefPtr& p) C << nl << "return " << flatName << '[' << scopedPos << "];"; C << eb; - C << sp << nl << "::IceInternal::Handle< ::IceDelegate::Ice::Object>"; - C << nl << "IceProxy" << scoped << "::__createDelegate()"; - C << sb; - C << nl << "return ::IceInternal::Handle< ::IceDelegate::Ice::Object>(new ::IceDelegate" << scoped << ");"; - C << eb; - C << sp; C << nl << "bool" << nl << "IceProxy" << scope << "operator==(const ::IceProxy" << scoped << "& l, const ::IceProxy" << scoped << "& r)"; @@ -1380,37 +1366,37 @@ Slice::Gen::ProxyVisitor::visitOperation(const OperationPtr& p) vector<string> params; vector<string> paramsDecl; + vector<string> paramsName; vector<string> args; + ParamDeclList inParams; + ParamDeclList outParams; ParamDeclList paramList = p->parameters(); for(ParamDeclList::const_iterator q = paramList.begin(); q != paramList.end(); ++q) { string paramName = fixKwd((*q)->name()); - StringList metaData = (*q)->getMetaData(); -#if defined(__SUNPRO_CC) && (__SUNPRO_CC==0x550) - // - // Work around for Sun CC 5.5 bug #4853566 - // + string typeString; if((*q)->isOutParam()) { + outParams.push_back(*q); typeString = outputTypeToString((*q)->type(), metaData); } else { + inParams.push_back(*q); typeString = inputTypeToString((*q)->type(), metaData); } -#else - string typeString = (*q)->isOutParam() ? - outputTypeToString((*q)->type(), metaData) : inputTypeToString((*q)->type(), metaData); -#endif params.push_back(typeString); paramsDecl.push_back(typeString + ' ' + paramName); + paramsName.push_back(paramName); args.push_back(paramName); } + paramsName.push_back("__out"); + string thisPointer = fixKwd(scope.substr(0, scope.size() - 2)) + "*"; H << sp; @@ -1438,15 +1424,48 @@ Slice::Gen::ProxyVisitor::visitOperation(const OperationPtr& p) { C << nl << "__checkTwowayOnly(\"" << name << "\");"; } - C << nl << "::IceInternal::Handle< ::IceDelegate::Ice::Object> __delBase = __getDelegate();"; - C << nl << "::IceDelegate" << thisPointer << " __del = dynamic_cast< ::IceDelegate" - << thisPointer << ">(__delBase.get());"; + C << nl << "static const ::std::string __operation(\"" << p->name() << "\");"; + C << nl << "__checkConnection();"; + C.zeroIndent(); + C << nl << "#ifdef ICEE_BLOCKING_CLIENT"; + C << nl << "# ifndef ICEE_PURE_BLOCKING_CLIENT"; + C.restoreIndent(); + C << nl << "if(_connection->blocking())"; + C.zeroIndent(); + C << nl << "# endif"; + C.restoreIndent(); + C << sb; + C << nl << "::IceInternal::Outgoing __out(_connection.get(), _reference.get(), __operation, " + << "static_cast< ::Ice::OperationMode>(" << p->mode() << "), __ctx);"; + C << nl; + if(ret) + { + C << "return "; + } + C << "__" << name << spar << paramsName << epar << ";"; + C << eb; + C.zeroIndent(); + C << nl << "# ifndef ICEE_PURE_BLOCKING_CLIENT"; + C.restoreIndent(); + C << nl << "else"; + C.zeroIndent(); + C << nl << "# endif"; + C << nl << "#endif"; + C << nl << "#ifndef ICEE_PURE_BLOCKING_CLIENT"; + C.restoreIndent(); + C << sb; + C << nl << "::IceInternal::OutgoingM __out(_connection.get(), _reference.get(), __operation, " + << "static_cast< ::Ice::OperationMode>(" << p->mode() << "), __ctx);"; C << nl; if(ret) { - C << "return "; + C << "return "; } - C << "__del->" << fixKwd(name) << spar << args << "__ctx" << epar << ';'; + C << "__" << name << spar << paramsName << epar << ";"; + C << eb; + C.zeroIndent(); + C << nl << "#endif"; + C.restoreIndent(); if(!ret) { C << nl << "return;"; @@ -1481,208 +1500,24 @@ Slice::Gen::ProxyVisitor::visitOperation(const OperationPtr& p) C << eb; C << eb; -} -Slice::Gen::DelegateVisitor::DelegateVisitor(Output& h, Output& c, const string& dllExport) : - H(h), C(c), _dllExport(dllExport) -{ -} - -bool -Slice::Gen::DelegateVisitor::visitUnitStart(const UnitPtr& p) -{ - if(!p->hasNonLocalClassDecls()) - { - return false; - } - - H << sp << nl << "namespace IceDelegate" << nl << '{'; - - return true; -} - -void -Slice::Gen::DelegateVisitor::visitUnitEnd(const UnitPtr& p) -{ - H << sp << nl << '}'; -} - -bool -Slice::Gen::DelegateVisitor::visitModuleStart(const ModulePtr& p) -{ - if(!p->hasNonLocalClassDecls()) - { - return false; - } - - string name = fixKwd(p->name()); - - H << sp << nl << "namespace " << name << nl << '{'; - - return true; -} - -void -Slice::Gen::DelegateVisitor::visitModuleEnd(const ModulePtr& p) -{ - H << sp << nl << '}'; -} - -bool -Slice::Gen::DelegateVisitor::visitClassDefStart(const ClassDefPtr& p) -{ - if(p->isLocal()) - { - return false; - } - - string name = fixKwd(p->name()); - ClassList bases = p->bases(); - - H << sp << nl << "class " << _dllExport << name << " : "; - if(bases.empty()) - { - H << "virtual public ::IceDelegate::Ice::Object"; - } - else - { - H.useCurrentPosAsIndent(); - ClassList::const_iterator q = bases.begin(); - while(q != bases.end()) - { - H << "virtual public ::IceDelegate" << fixKwd((*q)->scoped()); - if(++q != bases.end()) - { - H << ',' << nl; - } - } - H.restoreIndent(); - } - H << sb; - H.dec(); - H << nl << "public:"; - H.inc(); - - return true; -} - -void -Slice::Gen::DelegateVisitor::visitClassDefEnd(const ClassDefPtr& p) -{ - H << eb << ';'; -} - -void -Slice::Gen::DelegateVisitor::visitOperation(const OperationPtr& p) -{ - string name = fixKwd(p->name()); - string scope = fixKwd(p->scope()); - string scoped = fixKwd(p->scoped()); - - TypePtr ret = p->returnType(); - string retS = returnTypeToString(ret, p->getMetaData()); - - vector<string> params; - vector<string> paramsDecl; - vector<string> paramsName; - - ParamDeclList inParams; - ParamDeclList outParams; - ParamDeclList paramList = p->parameters(); - for(ParamDeclList::const_iterator q = paramList.begin(); q != paramList.end(); ++q) - { - string paramName = fixKwd((*q)->name()); - TypePtr type = (*q)->type(); - bool isOutParam = (*q)->isOutParam(); - StringList metaData = (*q)->getMetaData(); - - string typeString; - if(isOutParam) - { - outParams.push_back(*q); - typeString = outputTypeToString(type, metaData); - } - else - { - inParams.push_back(*q); - typeString = inputTypeToString(type, metaData); - } - - params.push_back(typeString); - paramsDecl.push_back(typeString + ' ' + paramName); - paramsName.push_back(paramName); - } - - params.push_back("const ::Ice::Context&"); - paramsDecl.push_back("const ::Ice::Context& __context"); - paramsName.push_back("__out"); - - H << sp << nl << "virtual " << retS << ' ' << name << spar << params << epar << ';'; - C << sp << nl << retS << nl << "IceDelegate" << scoped << spar << paramsDecl << epar; - C << sb; - C << nl << "static const ::std::string __operation(\"" << p->name() << "\");"; - C.zeroIndent(); - C << nl << "#ifdef ICEE_BLOCKING_CLIENT"; - C << nl << "# ifndef ICEE_PURE_BLOCKING_CLIENT"; - C.restoreIndent(); - C << nl << "if(__connection->blocking())"; - C.zeroIndent(); - C << nl << "# endif"; - C.restoreIndent(); - C << sb; - C << nl << "::IceInternal::Outgoing __out(__connection.get(), __reference.get(), __operation, " - << "static_cast< ::Ice::OperationMode>(" << p->mode() << "), __context);"; - C << nl; - if(ret) - { - C << "return "; - } - C << "__" << name << spar << paramsName << epar << ";"; - C << eb; - C.zeroIndent(); - C << nl << "# ifndef ICEE_PURE_BLOCKING_CLIENT"; - C.restoreIndent(); - C << nl << "else"; - C.zeroIndent(); - C << nl << "# endif"; - C << nl << "#endif"; - C << nl << "#ifndef ICEE_PURE_BLOCKING_CLIENT"; - C.restoreIndent(); - C << sb; - C << nl << "::IceInternal::OutgoingM __out(__connection.get(), __reference.get(), __operation, " - << "static_cast< ::Ice::OperationMode>(" << p->mode() << "), __context);"; - C << nl; - if(ret) - { - C << "return "; - } - C << "__" << name << spar << paramsName << epar << ";"; - C << eb; - C.zeroIndent(); - C << nl << "#endif"; - C.restoreIndent(); - C << eb; - - params.pop_back(); - paramsDecl.pop_back(); params.push_back("::IceInternal::Outgoing&"); paramsDecl.push_back("::IceInternal::Outgoing& __out"); - - H << sp << nl << "virtual " << retS << " __" << name << spar << params << epar << ';'; - C << sp << nl << retS << nl << "IceDelegate" << scope << "__" << name << spar << paramsDecl << epar; + H << nl << retS << " __" << name << spar << params << epar << ';'; + C << sp << nl << retS << nl << "IceProxy" << scope << "__" << name << spar << paramsDecl << epar; C << sb; if(!inParams.empty()) { - C << nl << "try"; - C << sb; - C << nl << "::IceInternal::BasicStream* __os = __out.os();"; - writeMarshalCode(C, inParams, 0, StringList(), true); - C << eb; - C << nl << "catch(const ::Ice::LocalException& __ex)"; - C << sb; - C << nl << "__out.abort(__ex);"; - C << eb; + C << nl << "try"; + C << sb; + C << nl << "::IceInternal::BasicStream* __os = __out.os();"; + writeMarshalCode(C, inParams, 0, StringList(), true); + C << eb; + C << nl << "catch(const ::Ice::LocalException& __ex)"; + C << sb; + C << nl << "__out.abort(__ex);"; + C << eb; } C << nl << "bool __ok = __out.invoke();"; C << nl << "try"; @@ -1728,10 +1563,10 @@ Slice::Gen::DelegateVisitor::visitOperation(const OperationPtr& p) #endif for(ExceptionList::const_iterator i = throws.begin(); i != throws.end(); ++i) { - C << nl << "catch(const " << fixKwd((*i)->scoped()) << "&)"; - C << sb; - C << nl << "throw;"; - C << eb; + C << nl << "catch(const " << fixKwd((*i)->scoped()) << "&)"; + C << sb; + C << nl << "throw;"; + C << eb; } C << nl << "catch(const ::Ice::UserException& __ex)"; C << sb; @@ -1745,7 +1580,7 @@ Slice::Gen::DelegateVisitor::visitOperation(const OperationPtr& p) writeUnmarshalCode(C, outParams, ret, p->getMetaData()); if(ret) { - C << nl << "return __ret;"; + C << nl << "return __ret;"; } C << eb; diff --git a/cpp/src/slice2cppe/Gen.h b/cpp/src/slice2cppe/Gen.h index fd57cfdf21c..ab9339f1959 100644 --- a/cpp/src/slice2cppe/Gen.h +++ b/cpp/src/slice2cppe/Gen.h @@ -148,28 +148,6 @@ private: std::string _dllExport; }; - class DelegateVisitor : private ::IceUtil::noncopyable, public ParserVisitor - { - public: - - DelegateVisitor(::IceUtil::Output&, ::IceUtil::Output&, const std::string&); - - virtual bool visitUnitStart(const UnitPtr&); - virtual void visitUnitEnd(const UnitPtr&); - virtual bool visitModuleStart(const ModulePtr&); - virtual void visitModuleEnd(const ModulePtr&); - virtual bool visitClassDefStart(const ClassDefPtr&); - virtual void visitClassDefEnd(const ClassDefPtr&); - virtual void visitOperation(const OperationPtr&); - - private: - - ::IceUtil::Output& H; - ::IceUtil::Output& C; - - std::string _dllExport; - }; - class ObjectDeclVisitor : private ::IceUtil::noncopyable, public ParserVisitor { public: diff --git a/cppe/include/IceE/Config.h b/cppe/include/IceE/Config.h index 1fac75707d7..a311b0d78cc 100644 --- a/cppe/include/IceE/Config.h +++ b/cppe/include/IceE/Config.h @@ -24,7 +24,7 @@ // Comment this out if you want to build without batch mode on the // client side. // -#define ICEE_HAS_BATCH +//#define ICEE_HAS_BATCH // // Comment this out if you want to build without support for blocking diff --git a/cppe/include/IceE/Proxy.h b/cppe/include/IceE/Proxy.h index 0a47d1be6cd..0fe604ef7ad 100644 --- a/cppe/include/IceE/Proxy.h +++ b/cppe/include/IceE/Proxy.h @@ -153,47 +153,13 @@ public: void __rethrowException(const ::Ice::LocalException&); void __checkTwowayOnly(const char*) const; - ::IceInternal::Handle< ::IceDelegate::Ice::Object> __getDelegate(); - protected: - virtual ::IceInternal::Handle< ::IceDelegate::Ice::Object> __createDelegate(); - const ::Ice::Context& __defaultContext() const; + void __checkConnection(); -private: - - void setup(const ::IceInternal::ReferencePtr&); - friend class ::IceInternal::ProxyFactory; - + ::Ice::ConnectionPtr _connection; ::IceInternal::ReferencePtr _reference; - ::IceInternal::Handle< ::IceDelegate::Ice::Object> _delegate; -}; - -} } - -namespace IceDelegate { namespace Ice -{ - -class ICE_API Object : public ::IceUtil::Shared -{ -public: - - ~Object(); - - bool ice_isA(const ::std::string&, const ::Ice::Context&); - void ice_ping(const ::Ice::Context&); - ::std::vector< ::std::string> ice_ids(const ::Ice::Context&); - ::std::string ice_id(const ::Ice::Context&); - - ::Ice::ConnectionPtr ice_connection(); - - void __copyFrom(const ::IceInternal::Handle< ::IceDelegate::Ice::Object>&); - -protected: - - ::IceInternal::ReferencePtr __reference; - ::Ice::ConnectionPtr __connection; private: @@ -203,7 +169,7 @@ private: ::std::string __ice_id(::IceInternal::Outgoing&); void setup(const ::IceInternal::ReferencePtr&); - friend class ::IceProxy::Ice::Object; + friend class ::IceInternal::ProxyFactory; }; } } diff --git a/cppe/include/IceE/ProxyF.h b/cppe/include/IceE/ProxyF.h index 942fb51dd52..3318aa30fd2 100644 --- a/cppe/include/IceE/ProxyF.h +++ b/cppe/include/IceE/ProxyF.h @@ -25,27 +25,12 @@ class Object; } -namespace IceDelegate -{ - -namespace Ice -{ - -class Object; - -} - -} - namespace IceInternal { ICE_API void incRef(::IceProxy::Ice::Object*); ICE_API void decRef(::IceProxy::Ice::Object*); -ICE_API void incRef(::IceDelegate::Ice::Object*); -ICE_API void decRef(::IceDelegate::Ice::Object*); - } #include <IceE/ProxyHandle.h> diff --git a/cppe/src/IceE/Proxy.cpp b/cppe/src/IceE/Proxy.cpp index f6544047d27..6412de2d777 100644 --- a/cppe/src/IceE/Proxy.cpp +++ b/cppe/src/IceE/Proxy.cpp @@ -26,9 +26,6 @@ using namespace IceInternal; void IceInternal::incRef(::IceProxy::Ice::Object* p) { p->__incRef(); } void IceInternal::decRef(::IceProxy::Ice::Object* p) { p->__decRef(); } -void IceInternal::incRef(::IceDelegate::Ice::Object* p) { p->__incRef(); } -void IceInternal::decRef(::IceDelegate::Ice::Object* p) { p->__decRef(); } - void Ice::__write(::IceInternal::BasicStream* __os, const ::Ice::Context& v, ::Ice::__U__Context) { @@ -174,8 +171,26 @@ IceProxy::Ice::Object::ice_isA(const string& __id, const Context& __context) try { __checkTwowayOnly("ice_isA"); - ::IceInternal::Handle< ::IceDelegate::Ice::Object> __del = __getDelegate(); - return __del->ice_isA(__id, __context); + static const string __operation("ice_isA"); + __checkConnection(); +#ifdef ICEE_BLOCKING_CLIENT +# ifndef ICEE_PURE_BLOCKING_CLIENT + if(_connection->blocking()) +# endif + { + Outgoing __og(_connection.get(), _reference.get(), __operation, ::Ice::Nonmutating, __context); + return __ice_isA(__id, __og); + } +# ifndef ICEE_PURE_BLOCKING_CLIENT + else +# endif +#endif +#ifndef ICEE_PURE_BLOCKING_CLIENT + { + OutgoingM __og(_connection.get(), _reference.get(), __operation, ::Ice::Nonmutating, __context); + return __ice_isA(__id, __og); + } +#endif } catch(const NonRepeatable& __ex) { @@ -194,6 +209,46 @@ IceProxy::Ice::Object::ice_isA(const string& __id, const Context& __context) } } +bool +IceProxy::Ice::Object::__ice_isA(const string& __id, Outgoing& __og) +{ + try + { + BasicStream* __os = __og.os(); + __os->write(__id); + } + catch(const ::Ice::LocalException& __ex) + { + __og.abort(__ex); + } + bool __ret; + bool __ok = __og.invoke(); + try + { + BasicStream* __is = __og.is(); + if(!__ok) + { + __is->throwException(); + } + __is->read(__ret); + } + catch(const ::Ice::UserException&) + { + throw ::Ice::UnknownUserException(__FILE__, __LINE__); + } + catch(const ::Ice::LocalException& __ex) + { + throw ::IceInternal::NonRepeatable(__ex); + } +#if defined(_MSC_VER) && (_MSC_VER == 1201) && defined(_M_ARM) // EVC4 SP4 bug. + catch(...) + { + throw; + } +#endif + return __ret; +} + void IceProxy::Ice::Object::ice_ping() { @@ -208,8 +263,26 @@ IceProxy::Ice::Object::ice_ping(const Context& __context) { try { - ::IceInternal::Handle< ::IceDelegate::Ice::Object> __del = __getDelegate(); - __del->ice_ping(__context); + static const string __operation("ice_ping"); + __checkConnection(); +#ifdef ICEE_BLOCKING_CLIENT +# ifndef ICEE_PURE_BLOCKING_CLIENT + if(_connection->blocking()) +# endif + { + Outgoing __og(_connection.get(), _reference.get(), __operation, ::Ice::Nonmutating, __context); + __ice_ping(__og); + } +# ifndef ICEE_PURE_BLOCKING_CLIENT + else +# endif +#endif +#ifndef ICEE_PURE_BLOCKING_CLIENT + { + OutgoingM __og(_connection.get(), _reference.get(), __operation, ::Ice::Nonmutating, __context); + __ice_ping(__og); + } +#endif return; } catch(const NonRepeatable& __ex) @@ -229,6 +302,36 @@ IceProxy::Ice::Object::ice_ping(const Context& __context) } } +void +IceProxy::Ice::Object::__ice_ping(Outgoing& __og) +{ + bool __ok = __og.invoke(); + try + { + BasicStream* __is = __og.is(); + if(!__ok) + { + __is->throwException(); + } + } + catch(const ::Ice::UserException&) + { + throw ::Ice::UnknownUserException(__FILE__, __LINE__); + } + catch(const ::Ice::LocalException& __ex) + { + throw ::IceInternal::NonRepeatable(__ex); + } +#if defined(_MSC_VER) && (_MSC_VER == 1201) && defined(_M_ARM) // EVC4 SP4 bug. + catch(...) + { + throw; + } +#endif +} + + + vector<string> IceProxy::Ice::Object::ice_ids() { @@ -244,8 +347,26 @@ IceProxy::Ice::Object::ice_ids(const Context& __context) try { __checkTwowayOnly("ice_ids"); - ::IceInternal::Handle< ::IceDelegate::Ice::Object> __del = __getDelegate(); - return __del->ice_ids(__context); + static const string __operation("ice_ids"); + __checkConnection(); +#ifdef ICEE_BLOCKING_CLIENT +# ifndef ICEE_PURE_BLOCKING_CLIENT + if(_connection->blocking()) +# endif + { + Outgoing __og(_connection.get(), _reference.get(), __operation, ::Ice::Nonmutating, __context); + return __ice_ids(__og); + } +# ifndef ICEE_PURE_BLOCKING_CLIENT + else +# endif +#endif +#ifndef ICEE_PURE_BLOCKING_CLIENT + { + OutgoingM __og(_connection.get(), _reference.get(), __operation, ::Ice::Nonmutating, __context); + return __ice_ids(__og); + } +#endif } catch(const NonRepeatable& __ex) { @@ -264,6 +385,37 @@ IceProxy::Ice::Object::ice_ids(const Context& __context) } } +vector<string> +IceProxy::Ice::Object::__ice_ids(Outgoing& __og) +{ + vector<string> __ret; + bool __ok = __og.invoke(); + try + { + BasicStream* __is = __og.is(); + if(!__ok) + { + __is->throwException(); + } + __is->read(__ret); + } + catch(const ::Ice::UserException&) + { + throw ::Ice::UnknownUserException(__FILE__, __LINE__); + } + catch(const ::Ice::LocalException& __ex) + { + throw ::IceInternal::NonRepeatable(__ex); + } +#if defined(_MSC_VER) && (_MSC_VER == 1201) && defined(_M_ARM) // EVC4 SP4 bug. + catch(...) + { + throw; + } +#endif + return __ret; +} + string IceProxy::Ice::Object::ice_id() { @@ -279,8 +431,26 @@ IceProxy::Ice::Object::ice_id(const Context& __context) try { __checkTwowayOnly("ice_id"); - ::IceInternal::Handle< ::IceDelegate::Ice::Object> __del = __getDelegate(); - return __del->ice_id(__context); + static const string __operation("ice_id"); + __checkConnection(); +#ifdef ICEE_BLOCKING_CLIENT +#ifndef ICEE_PURE_BLOCKING_CLIENT + if(_connection->blocking()) +#endif + { + Outgoing __og(_connection.get(), _reference.get(), __operation, ::Ice::Nonmutating, __context); + return __ice_id(__og); + } +# ifndef ICEE_PURE_BLOCKING_CLIENT + else +# endif +#endif +#ifndef ICEE_PURE_BLOCKING_CLIENT + { + OutgoingM __og(_connection.get(), _reference.get(), __operation, ::Ice::Nonmutating, __context); + return __ice_id(__og); + } +#endif } catch(const NonRepeatable& __ex) { @@ -299,6 +469,38 @@ IceProxy::Ice::Object::ice_id(const Context& __context) } } +string +IceProxy::Ice::Object::__ice_id(Outgoing& __og) +{ + string __ret; + bool __ok = __og.invoke(); + try + { + BasicStream* __is = __og.is(); + if(!__ok) + { + __is->throwException(); + } + __is->read(__ret); + } + catch(const ::Ice::UserException&) + { + throw ::Ice::UnknownUserException(__FILE__, __LINE__); + } + catch(const ::Ice::LocalException& __ex) + { + throw ::IceInternal::NonRepeatable(__ex); + } +#if defined(_MSC_VER) && (_MSC_VER == 1201) && defined(_M_ARM) // EVC4 SP4 bug. + catch(...) + { + throw; + } +#endif + return __ret; +} + + Context IceProxy::Ice::Object::ice_getContext() const { @@ -490,25 +692,7 @@ IceProxy::Ice::Object::ice_locator(const LocatorPrx& locator) const ConnectionPtr IceProxy::Ice::Object::ice_connection() { - int __cnt = 0; - while(true) - { - try - { - ::IceInternal::Handle< ::IceDelegate::Ice::Object> __del = __getDelegate(); - return __del->ice_connection(); - } - catch(const LocalException& __ex) - { - __handleException(__ex, __cnt); - } -#if defined(_MSC_VER) && (_MSC_VER == 1201) && defined(_M_ARM) // EVC4 SP4 bug. - catch(...) - { - throw; - } -#endif - } + return _connection; } ReferencePtr @@ -521,13 +705,13 @@ void IceProxy::Ice::Object::__copyFrom(const ObjectPrx& from) { ReferencePtr ref; - ::IceInternal::Handle< ::IceDelegate::Ice::Object> delegate; + ConnectionPtr con; { ::IceUtil::Mutex::Lock sync(*from.get()); ref = from->_reference; - delegate = dynamic_cast< ::IceDelegate::Ice::Object*>(from->_delegate.get()); + con = from->_connection; } // @@ -536,26 +720,21 @@ IceProxy::Ice::Object::__copyFrom(const ObjectPrx& from) // assert(!_reference); - assert(!_delegate); + assert(!_connection); _reference = ref; - - if(delegate) - { - _delegate = __createDelegate(); - _delegate->__copyFrom(delegate); - } + _connection = con; } void IceProxy::Ice::Object::__handleException(const LocalException& ex, int& cnt) { // - // Only _delegate needs to be mutex protected here. + // Only _connection needs to be mutex protected here. // { - ::IceUtil::Mutex::Lock sync(*this); - _delegate = 0; + ::IceUtil::Mutex::Lock sync(*this); + _connection = 0; } ProxyFactoryPtr proxyFactory = _reference->getInstance()->proxyFactory(); @@ -576,11 +755,11 @@ void IceProxy::Ice::Object::__rethrowException(const LocalException& ex) { // - // Only _delegate needs to be mutex protected here. + // Only _connection needs to be mutex protected here. // { - ::IceUtil::Mutex::Lock sync(*this); - _delegate = 0; + ::IceUtil::Mutex::Lock sync(*this); + _connection = 0; } ex.ice_throw(); @@ -602,40 +781,6 @@ IceProxy::Ice::Object::__checkTwowayOnly(const char* name) const } } -::IceInternal::Handle< ::IceDelegate::Ice::Object> -IceProxy::Ice::Object::__getDelegate() -{ - ::IceUtil::Mutex::Lock sync(*this); - - if(!_delegate) - { - IceInternal::Handle< ::IceDelegate::Ice::Object> delegate = __createDelegate(); - delegate->setup(_reference); - _delegate = delegate; - - // - // If this proxy is for a non-local object, and we are - // using a router, then add this proxy to the router info - // object. - // -#ifdef ICEE_HAS_ROUTER - RoutableReferencePtr rr = RoutableReferencePtr::dynamicCast(_reference); - if(rr && rr->getRouterInfo()) - { - rr->getRouterInfo()->addProxy(this); - } -#endif - } - - return _delegate; -} - -::IceInternal::Handle< ::IceDelegate::Ice::Object> -IceProxy::Ice::Object::__createDelegate() -{ - return ::IceInternal::Handle< ::IceDelegate::Ice::Object>(new ::IceDelegate::Ice::Object); -} - const Context& IceProxy::Ice::Object::__defaultContext() const { @@ -643,291 +788,42 @@ IceProxy::Ice::Object::__defaultContext() const } void -IceProxy::Ice::Object::setup(const ReferencePtr& ref) +IceProxy::Ice::Object::__checkConnection() { - // - // No need to synchronize "*this", as this operation is only - // called upon initialization. - // - - assert(!_reference); - assert(!_delegate); - - _reference = ref; -} - -IceDelegate::Ice::Object::~Object() -{ -} - -bool -IceDelegate::Ice::Object::ice_isA(const string& __id, const Context& __context) -{ - static const string __operation("ice_isA"); -#ifdef ICEE_BLOCKING_CLIENT -# ifndef ICEE_PURE_BLOCKING_CLIENT - if(__connection->blocking()) -# endif - { - Outgoing __og(__connection.get(), __reference.get(), __operation, ::Ice::Nonmutating, __context); - return __ice_isA(__id, __og); - } -# ifndef ICEE_PURE_BLOCKING_CLIENT - else -# endif -#endif -#ifndef ICEE_PURE_BLOCKING_CLIENT - { - OutgoingM __og(__connection.get(), __reference.get(), __operation, ::Ice::Nonmutating, __context); - return __ice_isA(__id, __og); - } -#endif -} - -bool -IceDelegate::Ice::Object::__ice_isA(const string& __id, Outgoing& __og) -{ - try - { - BasicStream* __os = __og.os(); - __os->write(__id); - } - catch(const ::Ice::LocalException& __ex) - { - __og.abort(__ex); - } - bool __ret; - bool __ok = __og.invoke(); - try - { - BasicStream* __is = __og.is(); - if(!__ok) - { - __is->throwException(); - } - __is->read(__ret); - } - catch(const ::Ice::UserException&) - { - throw ::Ice::UnknownUserException(__FILE__, __LINE__); - } - catch(const ::Ice::LocalException& __ex) - { - throw ::IceInternal::NonRepeatable(__ex); - } -#if defined(_MSC_VER) && (_MSC_VER == 1201) && defined(_M_ARM) // EVC4 SP4 bug. - catch(...) - { - throw; - } -#endif - return __ret; -} - -void -IceDelegate::Ice::Object::ice_ping(const Context& __context) -{ - static const string __operation("ice_ping"); -#ifdef ICEE_BLOCKING_CLIENT -# ifndef ICEE_PURE_BLOCKING_CLIENT - if(__connection->blocking()) -# endif - { - Outgoing __og(__connection.get(), __reference.get(), __operation, ::Ice::Nonmutating, __context); - __ice_ping(__og); - } -# ifndef ICEE_PURE_BLOCKING_CLIENT - else -# endif -#endif -#ifndef ICEE_PURE_BLOCKING_CLIENT - { - OutgoingM __og(__connection.get(), __reference.get(), __operation, ::Ice::Nonmutating, __context); - __ice_ping(__og); - } -#endif - -} - -void -IceDelegate::Ice::Object::__ice_ping(Outgoing& __og) -{ - bool __ok = __og.invoke(); - try - { - BasicStream* __is = __og.is(); - if(!__ok) - { - __is->throwException(); - } - } - catch(const ::Ice::UserException&) - { - throw ::Ice::UnknownUserException(__FILE__, __LINE__); - } - catch(const ::Ice::LocalException& __ex) - { - throw ::IceInternal::NonRepeatable(__ex); - } -#if defined(_MSC_VER) && (_MSC_VER == 1201) && defined(_M_ARM) // EVC4 SP4 bug. - catch(...) - { - throw; - } -#endif -} - -vector<string> -IceDelegate::Ice::Object::ice_ids(const Context& __context) -{ - static const string __operation("ice_ids"); -#ifdef ICEE_BLOCKING_CLIENT -# ifndef ICEE_PURE_BLOCKING_CLIENT - if(__connection->blocking()) -# endif - { - Outgoing __og(__connection.get(), __reference.get(), __operation, ::Ice::Nonmutating, __context); - return __ice_ids(__og); - } -# ifndef ICEE_PURE_BLOCKING_CLIENT - else -# endif -#endif -#ifndef ICEE_PURE_BLOCKING_CLIENT - { - OutgoingM __og(__connection.get(), __reference.get(), __operation, ::Ice::Nonmutating, __context); - return __ice_ids(__og); - } -#endif - -} + ::IceUtil::Mutex::Lock sync(*this); -vector<string> -IceDelegate::Ice::Object::__ice_ids(Outgoing& __og) -{ - vector<string> __ret; - bool __ok = __og.invoke(); - try - { - BasicStream* __is = __og.is(); - if(!__ok) - { - __is->throwException(); - } - __is->read(__ret); - } - catch(const ::Ice::UserException&) + if(!_connection) { - throw ::Ice::UnknownUserException(__FILE__, __LINE__); - } - catch(const ::Ice::LocalException& __ex) - { - throw ::IceInternal::NonRepeatable(__ex); - } -#if defined(_MSC_VER) && (_MSC_VER == 1201) && defined(_M_ARM) // EVC4 SP4 bug. - catch(...) - { - throw; - } -#endif - return __ret; -} + _connection = _reference->getConnection(); -string -IceDelegate::Ice::Object::ice_id(const Context& __context) -{ - static const string __operation("ice_id"); -#ifdef ICEE_BLOCKING_CLIENT -#ifndef ICEE_PURE_BLOCKING_CLIENT - if(__connection->blocking()) -#endif - { - Outgoing __og(__connection.get(), __reference.get(), __operation, ::Ice::Nonmutating, __context); - return __ice_id(__og); - } -# ifndef ICEE_PURE_BLOCKING_CLIENT - else -# endif -#endif -#ifndef ICEE_PURE_BLOCKING_CLIENT - { - OutgoingM __og(__connection.get(), __reference.get(), __operation, ::Ice::Nonmutating, __context); - return __ice_id(__og); - } + // + // If this proxy is for a non-local object, and we are + // using a router, then add this proxy to the router info + // object. + // +#ifdef ICEE_HAS_ROUTER + RoutableReferencePtr rr = RoutableReferencePtr::dynamicCast(_reference); + if(rr && rr->getRouterInfo()) + { + rr->getRouterInfo()->addProxy(this); + } #endif - -} - -string -IceDelegate::Ice::Object::__ice_id(Outgoing& __og) -{ - string __ret; - bool __ok = __og.invoke(); - try - { - BasicStream* __is = __og.is(); - if(!__ok) - { - __is->throwException(); - } - __is->read(__ret); - } - catch(const ::Ice::UserException&) - { - throw ::Ice::UnknownUserException(__FILE__, __LINE__); } - catch(const ::Ice::LocalException& __ex) - { - throw ::IceInternal::NonRepeatable(__ex); - } -#if defined(_MSC_VER) && (_MSC_VER == 1201) && defined(_M_ARM) // EVC4 SP4 bug. - catch(...) - { - throw; - } -#endif - return __ret; } -ConnectionPtr -IceDelegate::Ice::Object::ice_connection() -{ - return __connection; -} void -IceDelegate::Ice::Object::__copyFrom(const ::IceInternal::Handle< ::IceDelegate::Ice::Object>& from) -{ - // - // No need to synchronize "from", as the delegate is immutable - // after creation. - // - - // - // No need to synchronize "*this", as this operation is only - // called upon initialization. - // - - assert(!__reference); - assert(!__connection); - - __reference = from->__reference; - __connection = from->__connection; -} - -void -IceDelegate::Ice::Object::setup(const ReferencePtr& ref) +IceProxy::Ice::Object::setup(const ReferencePtr& ref) { // // No need to synchronize "*this", as this operation is only // called upon initialization. // - assert(!__reference); - assert(!__connection); + assert(!_reference); + assert(!_connection); - __reference = ref; - __connection = __reference->getConnection(); + _reference = ref; } bool diff --git a/cppe/src/TcpTransport/Transceiver.cpp b/cppe/src/TcpTransport/Transceiver.cpp index 465dc4d7c29..5809ec869fc 100644 --- a/cppe/src/TcpTransport/Transceiver.cpp +++ b/cppe/src/TcpTransport/Transceiver.cpp @@ -95,7 +95,7 @@ IceInternal::Transceiver::write(Buffer& buf, int timeout) Buffer::Container::difference_type packetSize = static_cast<Buffer::Container::difference_type>(buf.b.end() - buf.i); - + #ifdef _WIN32 // // Limit packet size to avoid performance problems on WIN32 |