OmniEvents
ProxyManager.h
Go to the documentation of this file.
1 // Package : omniEvents
2 // ProxyManager.h Created : 2003/12/04
3 // Author : Alex Tingle
4 //
5 // Copyright (C) 2003-2005 Alex Tingle.
6 //
7 // This file is part of the omniEvents application.
8 //
9 // omniEvents is free software; you can redistribute it and/or
10 // modify it under the terms of the GNU Lesser General Public
11 // License as published by the Free Software Foundation; either
12 // version 2.1 of the License, or (at your option) any later version.
13 //
14 // omniEvents is distributed in the hope that it will be useful,
15 // but WITHOUT ANY WARRANTY; without even the implied warranty of
16 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 // Lesser General Public License for more details.
18 //
19 // You should have received a copy of the GNU Lesser General Public
20 // License along with this library; if not, write to the Free Software
21 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 //
23 
24 #ifndef OMNIEVENTS__PROXYMANAGER_H
25 #define OMNIEVENTS__PROXYMANAGER_H
26 
27 #ifdef HAVE_CONFIG_H
28 # include "config.h"
29 #endif
30 
31 #include <set>
32 #include <string>
33 
34 #ifdef HAVE_IOSTREAM
35 # include <iostream>
36 #else
37 # include <iostream.h>
38 #endif
39 
40 #include "Servant.h"
41 
42 #ifdef HAVE_STD_IOSTREAM
43 using namespace std;
44 #endif
45 
46 namespace OmniEvents {
47 
48 class Proxy;
49 class PersistNode;
50 
58 : public virtual POA_PortableServer::ServantActivator,
59  public Servant
60 {
61 public: // CORBA interface methods
63  void etherealize(
64  const PortableServer::ObjectId& oid,
65  PortableServer::POA_ptr adapter,
66  PortableServer::Servant serv,
67  CORBA::Boolean cleanup_in_progress,
68  CORBA::Boolean remaining_activations
69  );
70 
71 public:
73  void reincarnate(const PersistNode& node);
75  void output(ostream& os);
76 
77 protected:
79  ProxyManager(PortableServer::POA_ptr poa);
80  virtual ~ProxyManager();
81 
87  void activate(const char* name);
88 
90  set<Proxy*> _servants;
95  PortableServer::POA_var _managedPoa;
96 };
97 
98 
104 class Proxy
105 : public virtual PortableServer::ServantBase,
106  public Servant
107 {
108 public:
109  virtual ~Proxy();
111  virtual void reincarnate(const string& oid, const PersistNode& node)=0;
113  virtual void output(ostream &os)=0;
114 protected:
115  Proxy(PortableServer::POA_ptr poa);
116 
118  void keyOutput(ostream& os, const char* name);
120  void eraseKey(const char* name);
122  void basicOutput(
123  ostream& os, const char* name,
124  CORBA::Object_ptr target=CORBA::Object::_nil(),
125  const char* extraAttributes=NULL
126  );
127 
128  CORBA::Request_var _req;
129 private:
130  Proxy(const Proxy&);
131 };
132 
133 
134 }; // end namespace OmniEvents
135 
136 #endif // OMNIEVENTS__PROXYMANAGER_H
Base class for ServantActivator classes that manage Proxy servants.
Definition: ProxyManager.h:60
set< Proxy * > _servants
The set of all active Proxies in this object's _managedPoa.
Definition: ProxyManager.h:90
PortableServer::POA_var _managedPoa
The POA owned & managed by this object.
Definition: ProxyManager.h:95
Base class for three of the four Proxy servants.
Definition: ProxyManager.h:107
virtual void output(ostream &os)=0
Save this object's state to a stream.
CORBA::Request_var _req
Definition: ProxyManager.h:128
virtual void reincarnate(const string &oid, const PersistNode &node)=0
Re-create a servant from information saved in the log file.
Proxy(const Proxy &)
NO IMPLEMENTATION.
Base class for servants.
Definition: Servant.h:114