summaryrefslogtreecommitdiff
path: root/cpp/test/Glacier2/sessionControl/SessionI.cpp
diff options
context:
space:
mode:
authorBernard Normier <bernard@zeroc.com>2019-11-01 11:24:52 -0400
committerJoe George <joe@zeroc.com>2021-02-02 10:55:08 -0500
commit336c68e6e413f45a7269ca6e83850d9e1ef9f751 (patch)
treed3fc90d53718041c9760cde317b8be194a20807c /cpp/test/Glacier2/sessionControl/SessionI.cpp
parentRemove Ice::Application & Glacier2::Application deprecated classes (diff)
downloadice-336c68e6e413f45a7269ca6e83850d9e1ef9f751.tar.bz2
ice-336c68e6e413f45a7269ca6e83850d9e1ef9f751.tar.xz
ice-336c68e6e413f45a7269ca6e83850d9e1ef9f751.zip
Update Glacier2 tests to use C++11 mapping
Diffstat (limited to 'cpp/test/Glacier2/sessionControl/SessionI.cpp')
-rw-r--r--cpp/test/Glacier2/sessionControl/SessionI.cpp47
1 files changed, 8 insertions, 39 deletions
diff --git a/cpp/test/Glacier2/sessionControl/SessionI.cpp b/cpp/test/Glacier2/sessionControl/SessionI.cpp
index 5d25ab239ae..693992514ff 100644
--- a/cpp/test/Glacier2/sessionControl/SessionI.cpp
+++ b/cpp/test/Glacier2/sessionControl/SessionI.cpp
@@ -9,35 +9,8 @@
using namespace std;
using namespace Test;
-class DestroyCB : public virtual IceUtil::Shared
-{
-public:
-
- DestroyCB(const Test::AMD_Session_destroyFromClientPtr& cb) : _cb(cb)
- {
- }
-
- void
- response()
- {
- _cb->ice_response();
- }
-
- void
- exception(const IceUtil::Exception&)
- {
- test(false);
- }
-
-private:
-
- Test::AMD_Session_destroyFromClientPtr _cb;
-};
-
-typedef IceUtil::Handle<DestroyCB> DestroyCBPtr;
-
-Glacier2::SessionPrx
-SessionManagerI::create(const string& userId, const Glacier2::SessionControlPrx& sessionControl,
+shared_ptr<Glacier2::SessionPrx>
+SessionManagerI::create(string userId, shared_ptr<Glacier2::SessionControlPrx> sessionControl,
const Ice::Current& current)
{
if(userId == "rejectme")
@@ -48,23 +21,19 @@ SessionManagerI::create(const string& userId, const Glacier2::SessionControlPrx&
{
throw Ice::ObjectNotExistException(__FILE__, __LINE__);
}
- return Glacier2::SessionPrx::uncheckedCast(current.adapter->addWithUUID(new SessionI(sessionControl)));
+ return Ice::uncheckedCast<Glacier2::SessionPrx>(current.adapter->addWithUUID(make_shared<SessionI>(sessionControl)));
}
-SessionI::SessionI(const Glacier2::SessionControlPrx& sessionControl) :
- _sessionControl(sessionControl)
+SessionI::SessionI(shared_ptr<Glacier2::SessionControlPrx> sessionControl) :
+ _sessionControl(move(sessionControl))
{
- assert(sessionControl);
+ assert(_sessionControl);
}
void
-SessionI::destroyFromClient_async(const Test::AMD_Session_destroyFromClientPtr& cb, const Ice::Current&)
+SessionI::destroyFromClientAsync(function<void()> response, function<void(exception_ptr)>, const Ice::Current&)
{
- DestroyCBPtr asyncCB = new DestroyCB(cb);
- Glacier2::Callback_SessionControl_destroyPtr amiCB = Glacier2::newCallback_SessionControl_destroy(asyncCB,
- &DestroyCB::response,
- &DestroyCB::exception);
- _sessionControl->begin_destroy(amiCB);
+ _sessionControl->destroyAsync(move(response), [](exception_ptr){ test(false); });
}
void