OmniEvents
ProxyPushSupplier.h
Go to the documentation of this file.
1// Package : omniEvents
2// ProxyPushSupplier.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__PROXYPUSHSUPPLIER_H
25#define OMNIEVENTS__PROXYPUSHSUPPLIER_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 "Callback.h"
38#include "EventQueue.h"
39#include "ProxyManager.h"
40
41#include "CosEventChannelAdmin.hh"
42
43#ifdef HAVE_STD_IOSTREAM
44using namespace std;
45#endif
46
47namespace OmniEvents {
48
50: public ProxyManager,
51 public omni_thread
52{
53public: // CORBA interface methods
54 PortableServer::Servant incarnate(
55 const PortableServer::ObjectId& oid,
56 PortableServer::POA_ptr poa
57 );
59 void etherealize(
60 const PortableServer::ObjectId& oid,
61 PortableServer::POA_ptr adapter,
62 PortableServer::Servant serv,
63 CORBA::Boolean cleanup_in_progress,
64 CORBA::Boolean remaining_activations
65 );
66public:
67 ProxyPushSupplierManager(PortableServer::POA_ptr parentPoa,EventQueue& q);
69 CosEventChannelAdmin::ProxyPushSupplier_ptr createObject();
70
72 void disconnect();
73
74 void* run_undetached(void*);
75 void _add_ref();
76 void _remove_ref();
77
80
94
95private:
98};
99
100
102: public virtual POA_CosEventChannelAdmin::ProxyPushSupplier,
103 public Proxy,
104 public EventQueue::Reader,
105 public Callback
106{
107public: // CORBA interface methods
108 void connect_push_consumer(CosEventComm::PushConsumer_ptr pushConsumer);
110public:
111 ProxyPushSupplier_i(PortableServer::POA_ptr poa, EventQueue& q);
114
118 inline void trigger(bool& busy, bool& waiting);
119
121 void callback(CORBA::Request_ptr req);
122 void reincarnate(const string& oid, const PersistNode& node);
123 void output(ostream &os);
124private:
125 CosEventComm::PushConsumer_var _target;
127};
128
129
130//
131// Inline Implementations.
132//
133
141
143{
144 if(_p)
145 {
146 _p->_lock.unlock();
147 _p->_condition.signal(); // Wake up the thread if it's asleep.
148 }
149}
150
151
152}; // end namespace OmniEvents
153
154#endif // OMNIEVENTS__PROXYPUSHSUPPLIER_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
Interface for classes that wish to receive callbacks from deferred requests.
Definition Callback.h:46
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.
void disconnect()
Send disconnect_push_consumer() to all connected PushConsumers.
CosEventChannelAdmin::ProxyPushSupplier_ptr createObject()
void etherealize(const PortableServer::ObjectId &oid, PortableServer::POA_ptr adapter, PortableServer::Servant serv, CORBA::Boolean cleanup_in_progress, CORBA::Boolean remaining_activations)
Pauses the thread, and then calls the parent's implementation.
PortableServer::Servant incarnate(const PortableServer::ObjectId &oid, PortableServer::POA_ptr poa)
void _remove_ref()
Shutdown the thread when refCount reaches zero.
Helper class that locks ProxyPushSupplier upon construction, and wakes it up on destruction.
PauseThenWake(const PauseThenWake &)
Dummy, no implementation.
CosEventComm::PushConsumer_var _target
void connect_push_consumer(CosEventComm::PushConsumer_ptr pushConsumer)
OMNIEVENTS__DEBUG_REF_COUNTS__DECL void trigger(bool &busy, bool &waiting)
Sets 'busy' if some work was done.
void reincarnate(const string &oid, const PersistNode &node)
Re-create a servant from information saved in the log file.
bool _targetIsProxy
TRUE if _target is a ProxyPushConsumer.
void output(ostream &os)
Save this object's state to a stream.
void callback(CORBA::Request_ptr req)
Sets _targetIsProxy, if it is.