00001 // Package : omniEvents 00002 // EventsChannel.h Created : 2003/12/04 00003 // Author : Alex Tingle 00004 // 00005 // Copyright (C) 2003 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__EVENTCHANNEL_H 00025 #define OMNIEVENTS__EVENTCHANNEL_H 00026 00027 #ifdef HAVE_CONFIG_H 00028 # include "config.h" 00029 #endif 00030 00031 #ifdef HAVE_IOSTREAM 00032 # include <iostream> 00033 #else 00034 # include <iostream.h> 00035 #endif 00036 00037 #include "Servant.h" 00038 #include "CosEventChannelAdmin.hh" 00039 00040 #ifdef HAVE_STD_IOSTREAM 00041 using namespace std; 00042 #endif 00043 00044 class OEP_ecps; 00045 00046 namespace OmniEvents { 00047 00048 class SupplierAdmin_i; 00049 class ConsumerAdmin_i; 00050 00102 class EventChannel_i 00103 : public POA_CosEventChannelAdmin::EventChannel, 00104 public Servant, 00105 public omni_thread 00106 { 00107 public: // CORBA interface methods 00108 CosEventChannelAdmin::ConsumerAdmin_ptr for_consumers(); 00109 CosEventChannelAdmin::SupplierAdmin_ptr for_suppliers(); 00110 void destroy(); 00111 00112 public: 00113 EventChannel_i(const char* channelName); 00114 EventChannel_i(const char* channelName, const OEP_ecps& ecps); 00115 ~EventChannel_i(); 00116 00133 void run(void* arg); 00134 00135 void output(ostream& os); 00136 00137 void setPullRetryPeriod(CORBA::ULong v) {_pullRetryPeriod=v;} 00138 void setMaxQueueLength( CORBA::ULong v) {_maxQueueLength=v;} 00139 00140 CORBA::ULong pullRetryPeriod() const {return _pullRetryPeriod;} 00141 CORBA::ULong maxQueueLength() const {return _maxQueueLength;} 00142 00143 private: 00148 void createPoa(const char* channelName); 00149 00150 private: 00151 SupplierAdmin_i* _supplierAdmin; 00152 ConsumerAdmin_i* _consumerAdmin; 00153 PortableServer::POAManager_var _poaManager; 00154 bool _shutdownRequested; 00155 CORBA::ULong _pullRetryPeriod; 00156 CORBA::ULong _maxQueueLength; 00157 }; 00158 00159 }; // end namespace OmniEvents 00160 00161 #endif // OMNIEVENTS__EVENTCHANNEL_H