00001 #ifndef RT_SUPPLIER_H 00002 #define RT_SUPPLIER_H 00003 /* @(#) $Id: acsncRTSupplier.h,v 1.21 2010/04/29 20:00:45 javarias Exp $ 00004 * ALMA - Atacama Large Millimiter Array 00005 * (c) Associated Universities Inc., 2002 00006 * (c) European Southern Observatory, 2002 00007 * Copyright by ESO (in the framework of the ALMA collaboration) 00008 * and Cosylab 2002, All rights reserved 00009 * 00010 * This library is free software; you can redistribute it and/or 00011 * modify it under the terms of the GNU Lesser General Public 00012 * License as published by the Free Software Foundation; either 00013 * version 2.1 of the License, or (at your option) any later version. 00014 * 00015 * This library is distributed in the hope that it will be useful, 00016 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00017 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00018 * Lesser General Public License for more details. 00019 * 00020 * You should have received a copy of the GNU Lesser General Public 00021 * License along with this library; if not, write to the Free Software 00022 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00023 */ 00024 00031 #include "acsncSupplier.h" 00032 #include <queue> 00033 namespace nc { 00055 class RTSupplier : public Supplier 00056 { 00057 public: 00061 class EventProcessingCallback{ 00062 public: 00063 virtual void queueIsFull(::CORBA::Any_ptr event){} 00064 virtual void eventDropped(::CORBA::Any_ptr event){} 00065 virtual ~EventProcessingCallback(){} 00066 }; 00067 00068 00070 00079 RTSupplier(const char* channelName, 00080 acscomponent::ACSComponentImpl* component, 00081 const char* acsNCDomainName = 0); 00082 00091 virtual void 00092 disconnect(); 00093 00108 template <class T> void 00109 publishData(T data, EventProcessingCallback *evProcCallback=NULL); 00111 00117 unsigned int getQueueSize(); 00118 00119 00120 protected: 00124 virtual ~RTSupplier(); 00125 00138 static void 00139 worker(void* param_p); 00140 00144 baci::BACIThreadManager *threadManager_mp; 00145 00149 struct unpublishedEventData{ 00150 CosNotification::StructuredEvent event; 00151 EventProcessingCallback *callback; 00152 unsigned int tries; 00153 }; 00154 00158 std::queue<unpublishedEventData> unpublishedEvents_m; 00159 00165 CORBA::Any any_m; 00166 00171 ACE_Thread_Mutex eventQueueMutex_m; 00172 00176 Logging::RepeatGuardLogger<Logging::BaseLog> *rtSupGuardb; 00177 00181 Logging::RepeatGuardLogger<ACSErr::ACSbaseExImpl> *rtSupGuardex; 00182 00183 private: 00187 void operator=(const RTSupplier&); 00188 00192 RTSupplier(const RTSupplier&); 00193 }; 00194 }; 00195 00196 00197 #include "acsncRTSupplier.i" 00198 00199 #endif