00001 #ifndef _BULKDATANT_RECEIVER_IMPL_H 00002 #define _BULKDATANT_RECEIVER_IMPL_H 00003 /******************************************************************************* 00004 * ALMA - Atacama Large Millimiter Array 00005 * (c) European Southern Observatory, 2002 00006 * Copyright by ESO (in the framework of the ALMA collaboration) 00007 * and Cosylab 2002, All rights reserved 00008 * 00009 * This library 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 * This library 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 * "@(#)" 00025 * 00026 * who when what 00027 * -------- -------- ---------------------------------------------- 00028 * oat 30/03/04 created 00029 */ 00030 00031 /************************************************************************ 00032 * 00033 *---------------------------------------------------------------------- 00034 */ 00035 00036 #ifndef __cplusplus 00037 #error This is a C++ include file and cannot be used from plain C 00038 #endif 00039 00040 #include <baci.h> 00041 #include <baciCharacteristicComponentImpl.h> 00042 #include <maciHelper.h> 00043 #include <maciContainerServices.h> 00044 00045 #include "ACSBulkDataStatus.h" 00046 00047 #include "bulkDataReceiverS.h" 00048 00049 #include "bulkDataNTConfigurationParser.h" 00050 #include "bulkDataNTReceiverStream.h" 00051 00052 00075 template<class TCallback> 00076 class BulkDataNTReceiverImpl : public baci::CharacteristicComponentImpl, 00077 public virtual POA_bulkdata::BulkDataReceiver 00078 { 00079 public: 00080 00086 BulkDataNTReceiverImpl(const ACE_CString& name,maci::ContainerServices* containerServices); 00087 00091 virtual ~BulkDataNTReceiverImpl(); 00092 00093 virtual void initialize(); 00094 00095 virtual void cleanUp(); 00096 00097 AcsBulkdata::BulkDataNTReceiverStream<TCallback> * getReceiverStream(const char *streamName); 00098 00110 virtual void openReceiver(); 00111 00116 virtual void openReceiverStream(const char *stream_name); 00117 00124 void openReceiverStreamCfg (const char * stream_name, const char * stream_cfg); 00125 00132 void openReceiverFlow (const char * stream_name, const char * flow_name); 00133 00141 void openReceiverFlowCfg (const char * stream_name, const char * flow_name, const char * flow_cfg); 00142 00143 00147 bulkdata::BulkDataReceiverConfig * getReceiverConfig(); 00148 00152 virtual void closeReceiver(); 00153 00154 virtual void closeReceiverStream(const char *stream_name); 00155 00160 // stream + flow name 00161 virtual ACSErr::Completion *getCbStatus(CORBA::ULong flowNumber){ printf("getCbStatus not implemnted yet. \n"); return 0;} 00162 00167 // stream + flow name 00168 virtual void setTimeout(CORBA::ULong flowNumber, CORBA::ULong timeout){} 00169 00173 //get rid of 00174 virtual void setRecvName(const char *recvName); 00175 00179 virtual void subscribeNotification(ACS::CBvoid_ptr notifCb){} 00180 00189 void fwdData2UserCB(CORBA::Boolean enable); 00190 00191 protected: 00192 00197 virtual bool usesOldConfigurationMechanism(); 00198 00199 private: 00200 00201 // map<name, stream> 00202 typedef std::map<std::string, AcsBulkdata::BulkDataNTReceiverStream<TCallback> *> StreamMap; 00203 00204 00205 // Map that stores the actually stream objects that are actually created 00206 StreamMap receiverStreams_m; 00207 // ... and protection for the map StreamMap 00208 ACE_Recursive_Thread_Mutex rcvStreamMapMutex_m; 00209 00210 // The XML parser object, responsible of retrieving the configuration objects for a given XML document 00211 AcsBulkdata::BulkDataConfigurationParser *parser_m; 00212 00213 // Used to store the number of flows to create, as specified with the old config mechanism 00214 int defaultFlowsCount_m; 00215 00216 bool fwdData2UserCBenabled_m; 00217 00218 AcsBulkdata::BulkDataNTReceiverStream<TCallback>* createReceiverStream(const char *stream_name, const char *stream_cfg); 00219 00220 AcsBulkdata::BulkDataNTReceiverStream<TCallback>* createDefaultReceiverStream(const char *stream_cfg); 00221 00222 }; 00223 00224 #include "bulkDataNTReceiverImpl.i" 00225 00226 #endif