summaryrefslogtreecommitdiff
path: root/TAO/examples/POA/Forwarding/MyFooServant.h
blob: 7534f403a3388f7c2eac055abd906888af363a7b (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
77
78
79
80
81
82
83
84
// $Id$
//=============================================================================
//
//
// = FILENAME
//     MyFooServant.h
//
// = DESCRIPTION
//     Defines MyFooServant class for the Foo interface
//
// = AUTHOR
//     Irfan Pyarali and Michael Kircher
//
//=============================================================================

#ifndef MYFOOSERVANT_H
#define MYFOOSERVANT_H

#include "FooS.h"
#include "Servant_Locator.h"

class MyFirstFooServant : public POA_Foo
{
  // = TITLE
  // @@ Michael, please comment me.
public:
  // constructor - takes a POA and a value parameter
  MyFirstFooServant (CORBA::ORB_ptr orb_ptr,
                     PortableServer::POA_ptr poa_ptr,
                     CORBA::Long value,
                     CORBA::Object_ptr forward_to_ptr);

  // Destructor
  virtual ~MyFirstFooServant (void);

  //Returns the Default POA of this Servant object
  virtual PortableServer::POA_ptr _default_POA (CORBA::Environment &env);

  // Simple doit method
  virtual CORBA::Long doit (CORBA::Environment &env);

  // Setup forwarding
  virtual void forward (CORBA::Environment &env);

  virtual void shutdown (CORBA::Environment &env);

protected:
  // Default poa associated with this servant
  CORBA::ORB_var orb_var_;
  PortableServer::POA_var poa_var_;
  CORBA::Long value_;
  CORBA::Object_var forward_to_var_;
};

class MySecondFooServant : public POA_Foo
{
  // = TITLE
  // @@ Michael, please comment me.
public:
  // constructor - takes a POA and a value parameter
  MySecondFooServant (CORBA::ORB_ptr orb_ptr,
                      MyFooServantLocator *locator,
                      CORBA::Long value);

  // Destructor
  virtual ~MySecondFooServant (void);

  // Simple doit method
  virtual CORBA::Long doit (CORBA::Environment &env);

  // Setup forwarding
  virtual void forward (CORBA::Environment &env);

  virtual void shutdown (CORBA::Environment &env);

protected:
  // Default poa associated with this servant
  CORBA::ORB_var orb_var_;
  MyFooServantLocator *locator_ptr_;
  CORBA::Long value_;
};

#endif /* MYFOOSERVANT_H */