blob: 888b6805d338e7543a6d11b4330d04e7d5a13622 (
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
|
// $Id$
//================================================================================
//
// = LIBRARY
// TAO/tests/POA/Forwarding/Servant_Locator
//
// = FILENAME
// Servant_Locator.h
//
// = DESCRIPTION
// Defines a MyFooServantLocator class , used with a POA having
// a NON_RETAIN policy
//
// = AUTHOR
// Irfan Pyarali
//
//==================================================================================
#ifndef MYFOOSERVANTLOCATOR_H
#define MYFOOSERVANTLOCATOR_H
#include "tao/corba.h"
class MyFooServantLocator : public POA_PortableServer::ServantLocator
{
// = TITLE
// This class is used by a POA with USE_SERVANT_MANAGER and
// NON_RETAIN policy.
public:
MyFooServantLocator (CORBA::ORB_ptr orb_ptr,
CORBA::Object_ptr forward_to_ptr);
// constructor
~MyFooServantLocator ();
virtual PortableServer::Servant preinvoke (const PortableServer::ObjectId &oid,
PortableServer::POA_ptr adapter,
const char *operation,
PortableServer::ServantLocator::Cookie &the_cookie,
CORBA::Environment &env);
// This method is invoked by a POA whenever it receives a request
// for MyFoo object that is not currently active.
virtual void postinvoke (const PortableServer::ObjectId &oid,
PortableServer::POA_ptr adapter,
const char *operation,
PortableServer::ServantLocator::Cookie the_cookie,
PortableServer::Servant the_servant,
CORBA::Environment &env);
// This method is invoked whenever a MyFooServant completes a
// request.
void forward (CORBA::Environment &env);
private:
CORBA::ORB_var orb_var_;
int counter_;
// Counter for number of invocations of this.
PortableServer::Servant servant_ptr_;
// There really exists only one servant, which is returned all the
// time.
CORBA::Object_var forward_to_var_;
// location to forward to
u_int forwarding_;
// flag to tell if to forward or not.
};
#endif /* MYFOOSERVANTLOCATOR_H */
|