summaryrefslogtreecommitdiff
path: root/cpp/demo/Ice/session/HelloSessionManagerI.cpp
diff options
context:
space:
mode:
authorMatthew Newhook <matthew@zeroc.com>2005-04-13 08:48:35 +0000
committerMatthew Newhook <matthew@zeroc.com>2005-04-13 08:48:35 +0000
commitd4ed5d38a15c1ad0fdd93e7af23ecedaf5315f7c (patch)
treeb709522dc8c2bb51fb54574c9726a0533b6cb877 /cpp/demo/Ice/session/HelloSessionManagerI.cpp
parentFixed race condition in Thread_opVoid class. (diff)
downloadice-d4ed5d38a15c1ad0fdd93e7af23ecedaf5315f7c.tar.bz2
ice-d4ed5d38a15c1ad0fdd93e7af23ecedaf5315f7c.tar.xz
ice-d4ed5d38a15c1ad0fdd93e7af23ecedaf5315f7c.zip
added session demo.
Diffstat (limited to 'cpp/demo/Ice/session/HelloSessionManagerI.cpp')
-rwxr-xr-xcpp/demo/Ice/session/HelloSessionManagerI.cpp76
1 files changed, 76 insertions, 0 deletions
diff --git a/cpp/demo/Ice/session/HelloSessionManagerI.cpp b/cpp/demo/Ice/session/HelloSessionManagerI.cpp
new file mode 100755
index 00000000000..0ad43dec770
--- /dev/null
+++ b/cpp/demo/Ice/session/HelloSessionManagerI.cpp
@@ -0,0 +1,76 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2005 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+#include <Ice/Ice.h>
+#include <HelloSessionManagerI.h>
+
+#include <HelloSession.h>
+
+using namespace std;
+using namespace Demo;
+
+class HelloSessionI : public HelloSession
+{
+public:
+
+ HelloSessionI(const SessionManagerIPtr& manager) :
+ _manager(manager)
+ {
+ }
+
+ ~HelloSessionI()
+ {
+ }
+
+ virtual void
+ sayHello(const Ice::Current&) const
+ {
+ cout << "Hello World!" << endl;
+ }
+
+ // Common session specific code.
+
+ //
+ // Destroy all session specific state.
+ //
+ virtual void
+ destroyed(const Ice::Current& c)
+ {
+ c.adapter->remove(c.id);
+ }
+
+ //
+ // This method is called by the client to destroy a session. All
+ // it should do is call remove on the session manager. All user
+ // specific cleanup should go in the destroyed() callback.
+ //
+ virtual void
+ destroy(const Ice::Current& c)
+ {
+ _manager->remove(c.id);
+ }
+
+ virtual void
+ refresh(const Ice::Current& c)
+ {
+ _manager->refresh(c.id);
+ }
+
+private:
+
+ const SessionManagerIPtr _manager;
+};
+
+SessionPrx
+HelloSessionManagerI::create(const Ice::Current& c)
+{
+ SessionPrx session = SessionPrx::uncheckedCast(c.adapter->addWithUUID(new HelloSessionI(this)));
+ add(session);
+ return session;
+}