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

bulkDataDistributerImpl.h

Go to the documentation of this file.
00001 #ifndef _BULKDATA_DISTRIBUTER_IMPL_H
00002 #define _BULKDATA_DISTRIBUTER_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       02/03/05  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 <Pair_T.h>
00046 
00047 #include "bulkDataDistributerS.h"
00048 #include "bulkDataDistributer.h"
00049 
00050 //#include "bulkDataReceiverS.h"
00051 
00052 #include "ACSBulkDataStatus.h"
00053 
00054 //forward declaration
00055 template<class TReceiverCallback, class TSenderCallback>
00056 class BulkDataDistributerNotifCb;
00057 
00080 template<class TReceiverCallback, class TSenderCallback = BulkDataSenderDefaultCallback>
00081 class BulkDataDistributerImpl : public baci::CharacteristicComponentImpl,
00082                                 public virtual POA_bulkdata::BulkDataDistributer
00083 {
00084 
00085 
00086     typedef ACE_Pair< AcsBulkdata::RecvData /*bulkdata::BulkDataReceiver_ptr*/, AcsBulkdata::BulkDataSender<TSenderCallback> *> Sender_Map_Pair;
00087 
00088     typedef ACE_Hash_Map_Manager <ACE_CString, Sender_Map_Pair, ACE_Null_Mutex>  Sender_Map;
00089     typedef ACE_Hash_Map_Entry <ACE_CString, Sender_Map_Pair > Sender_Map_Entry;
00090     typedef ACE_Hash_Map_Iterator <ACE_CString, Sender_Map_Pair ,ACE_Null_Mutex>  Sender_Map_Iterator;
00091 
00092   public:
00093     
00099     BulkDataDistributerImpl(const ACE_CString& name,maci::ContainerServices* containerServices);
00100   
00104     virtual ~BulkDataDistributerImpl();
00105 
00106     /*
00107     *  @throw ACSErr::ACSbaseExImpl
00108     */
00109     virtual void initialize();
00110 
00111     virtual void cleanUp();
00112 
00113 
00114 /********************* Sender part ********************/
00115 
00125     virtual void connect(bulkdata::BulkDataReceiver_ptr receiverObj_p);
00126 
00127 
00137     virtual void multiConnect(bulkdata::BulkDataReceiver_ptr receiverObj_p);
00138 
00148     virtual void connectByName(const char *receiverName_p);
00149 
00150     /*
00151      *  @throw ACSBulkDataError::AVDisconnectErrorEx 
00152     */
00153     virtual void disconnect();
00154         
00155     /*
00156      *  @throw ACSBulkDataError::AVDisconnectErrorEx 
00157     */
00158     virtual void multiDisconnect(bulkdata::BulkDataReceiver_ptr receiverObj_p);
00159 
00160     /*
00161      *  @throw ACSBulkDataError::AVDisconnectErrorEx 
00162     */
00163     virtual void disconnectByName(const char *receiverName_p);
00164 
00165 
00174     virtual void startSend();
00175 
00186     virtual void paceData();
00187 
00196     virtual void stopSend();
00197 
00198 /************************ Receiver part ********************/
00199 
00211     virtual void openReceiver();
00212 
00213     void openReceiverStream(const char * stream_name)
00214     {
00215         ACS_SHORT_LOG((LM_ERROR,"BulkDataDistributerImpl::openReceiverStream NOT implemented"));
00216     }
00217 
00218     /*
00219      *  @throw ACSBulkDataError::AVReceiverConfigErrorEx 
00220      */
00221     bulkdata::BulkDataReceiverConfig * getReceiverConfig();
00222     
00223     /*
00224      *  @throw ACSBulkDataError::AVCloseReceiverErrorEx
00225      */
00226     virtual void closeReceiver(); 
00227 
00228 
00229     void closeReceiverStream(const char * stream_name)
00230     {
00231         ACS_SHORT_LOG((LM_ERROR,"BulkDataDistributerImpl::closeReceiverStream NOT implemented"));
00232     }
00233 
00234     /*
00235      *  @throw ACSBulkDataError::AVSetReceiverErrorEx
00236      */
00237     virtual void setReceiver(const bulkdata::BulkDataReceiverConfig &receiverConfig);
00238 
00239     //protected:
00240 
00241     virtual AcsBulkdata::BulkDataDistributer<TReceiverCallback, TSenderCallback> *getDistributer() 
00242         {
00243             return &distributer;
00244         }
00245 
00246     /*
00247      *  @throw ACSBulkDataError::AVInvalidFlowNumberEx 
00248      *  @throw ACSBulkDataError::AVFlowEndpointErrorEx
00249      */
00250     virtual ACSErr::Completion *getCbStatus(CORBA::ULong flowNumber);
00251 
00252     virtual ACSErr::Completion *getReceiverCbStatus(const char *recvName, CORBA::ULong flowNumber); 
00253 
00254     /*
00255      *  @throw ACSBulkDataError::AVInvalidFlowNumberEx
00256      */
00257     virtual void setTimeout(CORBA::ULong flowNumber, CORBA::ULong timeout) 
00258         {
00259             //empty
00260         }
00261 
00262     /*
00263      *  @throw ACSBulkDataError::AVSetReceiverNameErrorEx
00264      */
00265     virtual void setRecvName(const char *recvName) 
00266         {
00267             //empty
00268         }
00269 
00270     /*
00271      *  @throw ACSBulkDataError::AVNotificationMechanismErrorEx
00272      */
00273     virtual void subscribeNotification(ACS::CBvoid_ptr notifCb);
00274 
00280     void fwdData2UserCB(CORBA::Boolean enable)
00281     {
00282         ACS_SHORT_LOG((LM_WARNING,"BulkDataDistributerImpl<>::fwdData2UserCB not implemnted!"));
00283     }
00284 
00285   private:
00286 
00287     maci::ContainerServices *containerServices_p;
00288     CDB::DAL_ptr dal_p;
00289 
00290     AcsBulkdata::BulkDataDistributer<TReceiverCallback, TSenderCallback> distributer;
00291 
00292     void rmEntryFromSenderMap(bulkdata::BulkDataReceiver_ptr receiverObj_p);
00293     void rmEntryFromSenderMap(const char *receiverName_p);
00294 };
00295 
00296 
00297 
00298 #include "bulkDataDistributerImpl.i"
00299 
00300 #endif 

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