ProxyPullSupplier.h

Go to the documentation of this file.
00001 //                            Package   : omniEvents
00002 // ProxyPullSupplier.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__PROXYPULLSUPPLIER_H
00025 #define OMNIEVENTS__PROXYPULLSUPPLIER_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 "ProxyManager.h"
00038 #include "EventQueue.h"
00039 
00040 #include "CosEventChannelAdmin.hh"
00041 
00042 #ifdef HAVE_STD_IOSTREAM
00043 using namespace std;
00044 #endif
00045 
00046 namespace OmniEvents {
00047 
00048 class EventChannel_i;
00049 
00050 class ProxyPullSupplierManager
00051 : public ProxyManager,
00052   public PortableServer::RefCountServantBase
00053 {
00054 public: // CORBA interface methods
00055   PortableServer::Servant incarnate(
00056     const PortableServer::ObjectId& oid,
00057     PortableServer::POA_ptr         poa
00058   );
00059 public:
00060   ProxyPullSupplierManager(
00061     const EventChannel_i&   channel,
00062     PortableServer::POA_ptr parentPoa,
00063     EventQueue&             q
00064   );
00065   ~ProxyPullSupplierManager();
00066   CosEventChannelAdmin::ProxyPullSupplier_ptr createObject();
00067 
00069   void disconnect();
00070 
00071 private:
00072   const EventChannel_i& _channel;
00073   EventQueue& _queue; 
00074   int         _maxNumProxies; 
00075 };
00076 
00077 
00083 class ProxyPullSupplier_i
00084 : public virtual POA_CosEventChannelAdmin::ProxyPullSupplier,
00085   public Proxy,
00086   public EventQueue::Reader
00087 {
00088 public: // CORBA interface methods
00089   void connect_pull_consumer(CosEventComm::PullConsumer_ptr pullConsumer);
00090   void disconnect_pull_supplier();
00091   CORBA::Any* pull();
00092   CORBA::Any* try_pull(CORBA::Boolean& has_event);
00093 public:
00094   ProxyPullSupplier_i(PortableServer::POA_ptr poa, EventQueue& q);
00095   ~ProxyPullSupplier_i();
00096   void reincarnate(const string& oid, const PersistNode& node);
00097   void output(ostream& os);
00098   inline unsigned long timestamp() const {return _timestamp;}
00099 private:
00100   CosEventComm::PullConsumer::_var_type _target;
00101   
00105   bool _connected;
00107   unsigned long _timestamp;
00109   inline void touch();
00110 };
00111 
00112 }; // end namespace OmniEvents
00113 
00114 #endif // OMNIEVENTS__PROXYPULLSUPPLIER_H

Generated on Mon Jan 9 03:52:13 2006 for OmniEvents by  doxygen 1.4.6