OmniEvents
ProxyPushConsumer.h
Go to the documentation of this file.
1// Package : omniEvents
2// ProxyPushConsumer.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__PROXYPUSHCONSUMER_H
25#define OMNIEVENTS__PROXYPUSHCONSUMER_H
26
27#ifdef HAVE_CONFIG_H
28# include "config.h"
29#endif
30
31#include <string>
32#include <map>
33#include <list>
34
35#ifdef HAVE_IOSTREAM
36# include <iostream>
37#else
38# include <iostream.h>
39#endif
40
41#include "Callback.h"
42#include "Servant.h"
43
44#include "CosEventChannelAdmin.hh"
45
46#ifdef HAVE_STD_IOSTREAM
47using namespace std;
48#endif
49
50namespace OmniEvents {
51
52class PersistNode;
53class ConsumerAdmin_i;
54
61: public virtual POA_CosEventChannelAdmin::ProxyPushConsumer,
62 public Servant
63{
64public: // CORBA interface methods
68 void connect_push_supplier(CosEventComm::PushSupplier_ptr pushSupplier);
69
74
76 void push(const CORBA::Any& event);
77
78public:
80 PortableServer::POA_ptr parentPoa,
82 ConsumerAdmin_i& consumerAdmin
83 );
84 virtual ~ProxyPushConsumer_i();
85
86 void trigger() {_useLocalQueue=false;}
87
94 CosEventChannelAdmin::ProxyPushConsumer_ptr createObject();
95
97 void disconnect();
98
100 void reincarnate(const PersistNode& node);
102 void output(ostream& os) const;
103
104private:
105 string currentObjectId() const;
106 struct Connection : public Callback
107 {
108 const char* _channelName;
109 string _oidstr;
110 CosEventComm::PushSupplier_var _target;
112
115 const char* channelName,
116 const string& oidstr,
117 CosEventComm::PushSupplier_ptr pushSupplier,
118 bool isProxy=false
119 );
120 virtual ~Connection();
123 void callback(CORBA::Request_ptr req);
125 void output(ostream& os) const;
126 private:
128#if OMNIEVENTS__DEBUG_SERVANT
129 static int _objectCount;
130#endif
131 };
132
135 CORBA::String_var _channelName;
139};
140
141}; // end namespace OmniEvents
142
143#endif // OMNIEVENTS__PROXYPUSHCONSUMER_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
Default servant for ProxyPushConsumer objects.
void disconnect_push_consumer()
We may not have a record of the supplier, so this method must accept calls from any supplier without ...
void push(const CORBA::Any &event)
Accepts events from any supplier, not just those stored in _connections.
void output(ostream &os) const
Save this object's state to a stream.
CosEventChannelAdmin::ProxyPushConsumer_ptr createObject()
Constructs a new object.
bool _useLocalQueue
Switch between RT/chunked modes.
void reincarnate(const PersistNode &node)
Re-create all servants from information saved in the log file.
void disconnect()
Send disconnect_push_supplier() to all connected PushSuppliers.
void connect_push_supplier(CosEventComm::PushSupplier_ptr pushSupplier)
If pushSupplier is provided, then it is stored in _connections.
map< string, Connection * > Connections_t
bool _targetIsProxy
TRUE if _target is a ProxyPushSupplier.
OMNIEVENTS__DEBUG_REF_COUNTS__DECL void callback(CORBA::Request_ptr req)
Sets _targetIsProxy, if it is.
void output(ostream &os) const
Save this object's state to a stream.
Base class for servants.
Definition Servant.h:114