diff options
Diffstat (limited to 'cpp/src')
-rw-r--r-- | cpp/src/Ice/Object.cpp | 28 | ||||
-rw-r--r-- | cpp/src/Ice/Proxy.cpp | 68 | ||||
-rw-r--r-- | cpp/src/slice2cpp/Gen.cpp | 8 |
3 files changed, 102 insertions, 2 deletions
diff --git a/cpp/src/Ice/Object.cpp b/cpp/src/Ice/Object.cpp index e54df1a47fb..8696938fd0b 100644 --- a/cpp/src/Ice/Object.cpp +++ b/cpp/src/Ice/Object.cpp @@ -82,6 +82,16 @@ Ice::Object::ice_ping(const Current&) // Nothing to do. } +vector<string> +Ice::Object::ice_ids(const Current&) +{ + // + // Note in general this must be __ids, not __classIds since + // __classIds is only classes and not interfaces. + // + return vector<string>(&__classIds[0], &__classIds[1]); +} + DispatchStatus Ice::Object::___ice_isA(Incoming& __in, const Current& __current) { @@ -101,8 +111,18 @@ Ice::Object::___ice_ping(Incoming&, const Current& __current) return DispatchOK; } +DispatchStatus +Ice::Object::___ice_ids(Incoming& __in, const Current& __current) +{ + BasicStream* __os = __in.os(); + vector<string> __ret = ice_ids(__current); + __os->write(__ret); + return DispatchOK; +} + string Ice::Object::__all[] = { + "ice_ids", "ice_isA", "ice_ping" }; @@ -120,11 +140,15 @@ Ice::Object::__dispatch(Incoming& in, const Current& current) switch (r.first - __all) { - case 0: + case 0: + { + return ___ice_ids(in, current); + } + case 1: { return ___ice_isA(in, current); } - case 1: + case 2: { return ___ice_ping(in, current); } diff --git a/cpp/src/Ice/Proxy.cpp b/cpp/src/Ice/Proxy.cpp index d00e0c98a73..fdd7ccf69d0 100644 --- a/cpp/src/Ice/Proxy.cpp +++ b/cpp/src/Ice/Proxy.cpp @@ -160,6 +160,32 @@ IceProxy::Ice::Object::ice_ping(const Context& __context) } } +vector<string> +IceProxy::Ice::Object::ice_ids(const Context& __context) +{ + int __cnt = 0; + while (true) + { + try + { + Handle< ::IceDelegate::Ice::Object> __del = __getDelegate(); + return __del->ice_ids(__context); + } + catch (const LocationForward& __ex) + { + __locationForward(__ex); + } + catch (const NonRepeatable& __ex) + { + __handleException(*__ex.get(), __cnt); + } + catch (const LocalException& __ex) + { + __handleException(__ex, __cnt); + } + } +} + void IceProxy::Ice::Object::ice_invoke(const string& operation, bool nonmutating, @@ -620,6 +646,21 @@ IceDelegateM::Ice::Object::ice_ping(const Context& __context) } } +vector<string> +IceDelegateM::Ice::Object::ice_ids(const Context& __context) +{ + static const string __operation("ice_ids"); + Outgoing __out(__connection, __reference, __operation, true, __context); + BasicStream* __is = __out.is(); + if (!__out.invoke()) + { + throw ::Ice::UnknownUserException(__FILE__, __LINE__); + } + vector<string> __ret; + __is->read(__ret); + return __ret; +} + void IceDelegateM::Ice::Object::ice_invoke(const string& operation, bool nonmutating, @@ -850,6 +891,33 @@ IceDelegateD::Ice::Object::ice_ping(const ::Ice::Context& __context) } } +vector<string> +IceDelegateD::Ice::Object::ice_ids(const ::Ice::Context& __context) +{ + Current __current; + __initCurrent(__current, "ice_ids", true, __context); + while (true) + { + Direct __direct(__adapter, __current); + try + { + return __direct.facetServant()->ice_ids(__current); + } + catch (const LocalException&) + { + throw UnknownLocalException(__FILE__, __LINE__); + } + catch (const UserException&) + { + throw UnknownUserException(__FILE__, __LINE__); + } + catch (...) + { + throw UnknownException(__FILE__, __LINE__); + } + } +} + void IceDelegateD::Ice::Object::ice_invoke(const string& operation, bool nonmutating, diff --git a/cpp/src/slice2cpp/Gen.cpp b/cpp/src/slice2cpp/Gen.cpp index 76d5929520b..a0b247af227 100644 --- a/cpp/src/slice2cpp/Gen.cpp +++ b/cpp/src/slice2cpp/Gen.cpp @@ -1855,6 +1855,7 @@ Slice::Gen::ObjectVisitor::visitClassDefStart(const ClassDefPtr& p) H << nl << exp2 << "static const ::std::string __classIds[" << classIds.size() << "];"; H << nl << exp2 << "virtual bool ice_isA(const ::std::string&, const ::Ice::Current& = ::Ice::Current());"; H << nl << exp2 << "virtual const ::std::string* __getClassIds() const;"; + H << nl << exp2 << "virtual ::std::vector< ::std::string> ice_ids(const ::Ice::Current& = ::Ice::Current());"; if (!p->isAbstract()) { H << sp << nl << exp2 << "static ::Ice::ObjectFactoryPtr _factory;"; @@ -1896,6 +1897,12 @@ Slice::Gen::ObjectVisitor::visitClassDefStart(const ClassDefPtr& p) C << sb; C << nl << "return __classIds;"; C << eb; + + C << sp; + C << nl << "::std::vector< ::std::string>" << nl << scoped.substr(2) << "::ice_ids(const ::Ice::Current&)"; + C << sb; + C << nl << "return ::std::vector< ::std::string>(&__ids[0], &__ids[" << ids.size() << "]);"; + C << eb; } return true; @@ -1930,6 +1937,7 @@ Slice::Gen::ObjectVisitor::visitClassDefEnd(const ClassDefPtr& p) { StringList allOpNames; transform(allOps.begin(), allOps.end(), back_inserter(allOpNames), ::IceUtil::memFun(&Operation::name)); + allOpNames.push_back("ice_ids"); allOpNames.push_back("ice_isA"); allOpNames.push_back("ice_ping"); allOpNames.sort(); |