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 00076 RTSupplier(const char* channelName, 00077 acscomponent::ACSComponentImpl* component); 00078 00087 virtual void 00088 disconnect(); 00089 00104 template <class T> void 00105 publishData(T data, EventProcessingCallback *evProcCallback=NULL); 00107 00113 unsigned int getQueueSize(); 00114 00115 00116 protected: 00120 virtual ~RTSupplier(); 00121 00134 static void 00135 worker(void* param_p); 00136 00140 baci::BACIThreadManager *threadManager_mp; 00141 00145 struct unpublishedEventData{ 00146 CosNotification::StructuredEvent event; 00147 EventProcessingCallback *callback; 00148 unsigned int tries; 00149 }; 00150 00154 std::queue<unpublishedEventData> unpublishedEvents_m; 00155 00161 CORBA::Any any_m; 00162 00167 ACE_Thread_Mutex eventQueueMutex_m; 00168 00172 Logging::RepeatGuardLogger<Logging::BaseLog> *rtSupGuardb; 00173 00177 Logging::RepeatGuardLogger<ACSErr::ACSbaseExImpl> *rtSupGuardex; 00178 00179 private: 00183 void operator=(const RTSupplier&); 00184 00188 RTSupplier(const RTSupplier&); 00189 }; 00190 }; 00191 00192 00193 #include "acsncRTSupplier.i" 00194 00195 #endif