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
43using namespace std;
44#endif
45
46namespace OmniEvents {
47
48class EventChannel_i;
49
51: public ProxyManager,
52 public PortableServer::RefCountServantBase
53{
54public: // CORBA interface methods
55 PortableServer::Servant incarnate(
56 const PortableServer::ObjectId& oid,
57 PortableServer::POA_ptr poa
58 );
59public:
62 PortableServer::POA_ptr parentPoa,
64 );
67 CosEventChannelAdmin::ProxyPullSupplier_ptr createObject();
68
70 void disconnect();
71
72private:
76};
77
78
85: public virtual POA_CosEventChannelAdmin::ProxyPullSupplier,
86 public Proxy,
88{
89public: // CORBA interface methods
90 void connect_pull_consumer(CosEventComm::PullConsumer_ptr pullConsumer);
92 CORBA::Any* pull();
93 CORBA::Any* try_pull(CORBA::Boolean& has_event);
94public:
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;}
100private:
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
T::_ptr_type createNarrowedReference(PortableServer::POA_ptr poa, const char *repositoryId)
Helper method that creates a new CORBA object and then narrows it to the appropriate type.
Definition Servant.h:96
Servant for CosEventChannelAdmin::EventChannel objects, also inherits from omni_thread.
The EventQueue is a circular buffer, that contains _size-1 events.
Definition EventQueue.h:57
Base class for ServantActivator classes that manage Proxy servants.
Base class for three of the four Proxy servants.
EventQueue & _queue
Reference to queue shared with ProxyPushSuppliers.
int _maxNumProxies
Upper limit on number of proxies.
void disconnect()
Send disconnect_pull_consumer() to all connected PullConsumers.
OMNIEVENTS__DEBUG_REF_COUNTS__DECL CosEventChannelAdmin::ProxyPullSupplier_ptr createObject()
PortableServer::Servant incarnate(const PortableServer::ObjectId &oid, PortableServer::POA_ptr poa)
Servant for ProxyPullSupplier interface.
void output(ostream &os)
Save this object's state to a stream.
void touch()
Update the _timestamp to the current moment.
CORBA::Any * try_pull(CORBA::Boolean &has_event)
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...
void connect_pull_consumer(CosEventComm::PullConsumer_ptr pullConsumer)
void reincarnate(const string &oid, const PersistNode &node)
Re-create a servant from information saved in the log file.