blob: 0ad43dec7702f47b11f9dcd6eac9ef5101c8cbff (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
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;
}
|