OmniEvents
ProxyPullSupplier.h
Go to the documentation of this file.
1 // Package : omniEvents
2 // ProxyPullSupplier.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__PROXYPULLSUPPLIER_H
25 #define OMNIEVENTS__PROXYPULLSUPPLIER_H
26 
27 #ifdef HAVE_CONFIG_H
28 # include "config.h"
29 #endif
30 
31 #ifdef HAVE_IOSTREAM
32 # include <iostream>
33 #else
34 # include <iostream.h>
35 #endif
36 
37 #include "ProxyManager.h"
38 #include "EventQueue.h"
39 
40 #include "CosEventChannelAdmin.hh"
41 
42 #ifdef HAVE_STD_IOSTREAM
43 using namespace std;
44 #endif
45 
46 namespace OmniEvents {
47 
48 class EventChannel_i;
49 
51 : public ProxyManager,
52  public PortableServer::RefCountServantBase
53 {
54 public: // CORBA interface methods
55  PortableServer::Servant incarnate(
56  const PortableServer::ObjectId& oid,
57  PortableServer::POA_ptr poa
58  );
59 public:
61  const EventChannel_i& channel,
62  PortableServer::POA_ptr parentPoa,
63  EventQueue& q
64  );
67  CosEventChannelAdmin::ProxyPullSupplier_ptr createObject();
68 
70  void disconnect();
71 
72 private:
76 };
77 
78 
85 : public virtual POA_CosEventChannelAdmin::ProxyPullSupplier,
86  public Proxy,
87  public EventQueue::Reader
88 {
89 public: // CORBA interface methods
90  void connect_pull_consumer(CosEventComm::PullConsumer_ptr pullConsumer);
91  void disconnect_pull_supplier();
92  CORBA::Any* pull();
93  CORBA::Any* try_pull(CORBA::Boolean& has_event);
94 public:
95  ProxyPullSupplier_i(PortableServer::POA_ptr poa, EventQueue& q);
97  void reincarnate(const string& oid, const PersistNode& node);
98  void output(ostream& os);
99  inline unsigned long timestamp() const {return _timestamp;}
100 private:
101  CosEventComm::PullConsumer_var _target;
102 
108  unsigned long _timestamp;
110  inline void touch();
111 };
112 
113 }; // end namespace OmniEvents
114 
115 #endif // OMNIEVENTS__PROXYPULLSUPPLIER_H
#define OMNIEVENTS__DEBUG_REF_COUNTS__DECL
Declares debug versions of _add/remove_ref().
Definition: Servant.h:68
Servant for CosEventChannelAdmin::EventChannel objects, also inherits from omni_thread.
Definition: EventChannel.h:115
The EventQueue is a circular buffer, that contains _size-1 events.
Definition: EventQueue.h:57
Base class for ServantActivator classes that manage Proxy servants.
Definition: ProxyManager.h:60
Base class for three of the four Proxy servants.
Definition: ProxyManager.h:107
EventQueue & _queue
Reference to queue shared with ProxyPushSuppliers.
int _maxNumProxies
Upper limit on number of proxies.
Servant for ProxyPullSupplier interface.
unsigned long timestamp() const
CosEventComm::PullConsumer_var _target
unsigned long _timestamp
Keep track of when this proxy was last contacted.
bool _connected
Can't use _target to keep track of whether this object is connected, because it is legal to connect w...