00001 // Package : omniEvents 00002 // ProxyPullCOnsumer.h Created : 2003/12/04 00003 // Author : Alex Tingle 00004 // 00005 // Copyright (C) 2003-2005 Alex Tingle. 00006 // 00007 // This file is part of the omniEvents application. 00008 // 00009 // omniEvents is free software; you can redistribute it and/or 00010 // modify it under the terms of the GNU Lesser General Public 00011 // License as published by the Free Software Foundation; either 00012 // version 2.1 of the License, or (at your option) any later version. 00013 // 00014 // omniEvents is distributed in the hope that it will be useful, 00015 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00016 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00017 // Lesser General Public License for more details. 00018 // 00019 // You should have received a copy of the GNU Lesser General Public 00020 // License along with this library; if not, write to the Free Software 00021 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00022 // 00023 00024 #ifndef OMNIEVENTS__PROXYPULLCONSUMER_H 00025 #define OMNIEVENTS__PROXYPULLCONSUMER_H 00026 00027 #ifdef HAVE_CONFIG_H 00028 # include "config.h" 00029 #endif 00030 00031 #include <list> 00032 00033 #ifdef HAVE_IOSTREAM 00034 # include <iostream> 00035 #else 00036 # include <iostream.h> 00037 #endif 00038 00039 #include "ProxyManager.h" 00040 00041 #include "CosEventChannelAdmin.hh" 00042 00043 #ifdef HAVE_STD_IOSTREAM 00044 using namespace std; 00045 #endif 00046 00047 namespace OmniEvents { 00048 00049 class ProxyPullConsumerManager 00050 : public ProxyManager, 00051 public PortableServer::RefCountServantBase 00052 { 00053 public: // CORBA interface methods 00054 PortableServer::Servant incarnate( 00055 const PortableServer::ObjectId& oid, 00056 PortableServer::POA_ptr poa 00057 ); 00058 public: 00059 ProxyPullConsumerManager( 00060 PortableServer::POA_ptr parentPoa, 00061 list<CORBA::Any*>& q 00062 ); 00063 ~ProxyPullConsumerManager(); 00064 OMNIEVENTS__DEBUG_REF_COUNTS__DECL 00065 CosEventChannelAdmin::ProxyPullConsumer_ptr createObject(); 00066 00077 void collect(); 00078 00083 void triggerRequest(); 00084 00086 void disconnect(); 00087 00088 private: 00089 list<CORBA::Any*>& _queue; 00090 }; 00091 00092 00100 class ProxyPullConsumer_i 00101 : public virtual POA_CosEventChannelAdmin::ProxyPullConsumer, 00102 public Proxy 00103 { 00104 public: // CORBA interface methods 00105 void connect_pull_supplier(CosEventComm::PullSupplier_ptr pullSupplier); 00106 void disconnect_pull_consumer(); 00107 public: 00108 ProxyPullConsumer_i(PortableServer::POA_ptr poa, list<CORBA::Any*>& q); 00109 ~ProxyPullConsumer_i(); 00110 00112 void collect(); 00114 void triggerRequest(); 00115 00116 void reincarnate(const string& oid, const PersistNode& node); 00117 void output(ostream& os); 00118 private: 00119 CosEventComm::PullSupplier_var _target; 00120 list<CORBA::Any*>& _queue; 00121 00123 enum Mode { Pull=0, TryPull=1 }; 00124 Mode _mode; 00125 00129 int _exceptionCount; 00130 }; 00131 00132 }; // end namespace OmniEvents 00133 00134 #endif // OMNIEVENTS__PROXYPULLCONSUMER_H