• Classes
  • Modules
  • Namespaces
  • Files
  • Related Pages
  • File List
  • File Members

bulkDataNTReceiverStream.h

Go to the documentation of this file.
00001 #ifndef _BULK_DATA_NT_RECEIVER_STREAM_H_
00002 #define _BULK_DATA_NT_RECEIVER_STREAM_H_
00003 /*******************************************************************************
00004  * ALMA - Atacama Large Millimiter Array
00005  * (c) European Southern Observatory, 2011
00006  *
00007  * This library is free software; you can redistribute it and/or
00008  * modify it under the terms of the GNU Lesser General Public
00009  * License as published by the Free Software Foundation; either
00010  * version 2.1 of the License, or (at your option) any later version.
00011  *
00012  * This library is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00015  * Lesser General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU Lesser General Public
00018  * License along with this library; if not, write to the Free Software
00019  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
00020  *
00021  * "@(#) $Id: bulkDataNTReceiverStream.h,v 1.12 2011/11/08 11:12:04 bjeram Exp $"
00022  *
00023  * who       when      what
00024  * --------  --------  ----------------------------------------------
00025  * bjeram  2011-04-19  created
00026  */
00027 
00028 /************************************************************************
00029  *
00030  *----------------------------------------------------------------------
00031  */
00032 
00033 #ifndef __cplusplus
00034 #error This is a C++ include file and cannot be used from plain C
00035 #endif
00036 
00037 #include "bulkDataNTStream.h"
00038 #include "bulkDataNTReceiverFlow.h"
00039 #include <map>
00040 
00041 namespace AcsBulkdata
00042 {
00043 
00044 
00045 
00046 //TBD: actually we can move lots of stuff from BulkDataNTReceiverStream template class which do not depend on template parameter
00047 class BulkDataNTReceiverStreamBase : public BulkDataNTStream
00048 {
00049 public:
00050         BulkDataNTReceiverStreamBase(const char* streamName, const ReceiverStreamConfiguration &cfg):
00051                 BulkDataNTStream(streamName, cfg), receiverName_m("DefaultReceiver") {}
00052 
00053         BulkDataNTReceiverStreamBase( const char* receiverName, const char* streamName, const ReceiverStreamConfiguration &cfg):
00054                         BulkDataNTStream(streamName, cfg), receiverName_m(receiverName){}
00055 
00063         void setReceiverName(char * recvName) { receiverName_m = recvName; }
00064         void setReceiverName(const char * recvName) { receiverName_m = recvName; }
00065 
00066         const char* getReceiverName() { return receiverName_m.c_str(); }
00067 
00068 protected:
00069 
00070         std::string receiverName_m;
00071 
00072 };//BulkDataNTReceiverStreamBase
00073 
00074 template<class TReceiverCallback>
00075 class BulkDataNTReceiverStream : public BulkDataNTReceiverStreamBase
00076 
00077 //, public AcsBulkdata::BulkDataNTDDSSubscriber
00078 
00079 {
00080 public:
00081 
00085         BulkDataNTReceiverStream(const char* streamName, const ReceiverStreamConfiguration &cfg=ReceiverStreamConfiguration());
00086 
00087         BulkDataNTReceiverStream(
00088                         const char* receiverName,
00089                         const char* streamName,
00090                         const ReceiverStreamConfiguration &cfg=ReceiverStreamConfiguration());
00091 
00095         virtual ~BulkDataNTReceiverStream();
00096 
00097 
00098 
00099         // TBD: is this better than createSingleFlow and createMultipleFlows
00100         // do we have to provide a name or just a number, for example we need three flows
00101         // if we decide for name then we have to change send methods as well.
00102         // here we should connect to the DDS topic
00103         // TBD: here we can also send the callback?
00104         BulkDataNTReceiverFlow* createFlow(const char *flowName, const ReceiverFlowConfiguration &cfg=ReceiverFlowConfiguration(),
00105                         BulkDataNTCallback *cb=0, bool releaseCB=false);
00106 
00107         BulkDataNTReceiverFlow* getFlow(const char* flowName);
00108 
00120         void createMultipleFlowsFromConfig(const char *config);
00121 
00132 
00133 
00145 
00146 
00157 
00158 
00166         void closeReceiver();
00167 
00174 
00175 
00176 
00185 
00186 
00198 
00199 
00200         /*
00201          *  @throw ACSBulkDataError::AVNotificationMechanismErrorExImpl
00202          */
00204 
00205 
00206 
00208 
00209 
00210 protected:
00211 
00212         virtual void removeFlowFromMap(const char* flow);
00213 
00214         typedef std::map<std::string, BulkDataNTReceiverFlow*> ReceiverFlowMap;
00215         ReceiverFlowMap receiverFlows_m;
00216         // we need a flag that prevents elements to be removed from map when we delete flows from dtor
00217         bool notRemoveFromMap_m;
00218 
00219 
00221         BulkDataNTReceiverStream();
00223         void operator=(const BulkDataNTReceiverStream&);
00225         BulkDataNTReceiverStream(const BulkDataNTReceiverStream&);
00226 };//class BulkDataNTReceiverStream
00227 
00228 };//namespace AcsBulkdata
00229 
00230 #include "bulkDataNTReceiverStream.i"
00231 
00232 #endif 

Generated on Thu Jan 12 2012 23:13:50 for ACS-10.0 C++ API by  doxygen 1.7.0