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

bulkDataNTCallback.h

Go to the documentation of this file.
00001 #ifndef _BULKDATA_NT_CALLBACK_H
00002 #define _BULKDATA_NT_CALLBACK_H
00003 
00004 /*******************************************************************************
00005 * ALMA - Atacama Large Millimiter Array
00006 * (c) European Southern Observatory, 2011
00007 *
00008 * This library is free software; you can redistribute it and/or
00009 * modify it under the terms of the GNU Lesser General Public
00010 * License as published by the Free Software Foundation; either
00011 * version 2.1 of the License, or (at your option) any later version.
00012 *
00013 * This library is distributed in the hope that it will be useful,
00014 * but WITHOUT ANY WARRANTY; without even the implied warranty of
00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00016 * Lesser General Public License for more details.
00017 *
00018 * You should have received a copy of the GNU Lesser General Public
00019 * License along with this library; if not, write to the Free Software
00020 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
00021 *
00022 * "@(#) $Id: bulkDataNTCallback.h,v 1.27 2012/09/06 10:50:30 bjeram Exp $"
00023 *
00024 * who       when      what
00025 * --------  --------  ----------------------------------------------
00026 * bjeram  2011-04-19  created
00027 */
00028 
00029 
00030 #ifndef __cplusplus
00031 #error This is a C++ include file and cannot be used from plain C
00032 #endif
00033 
00034 #include <acserr.h>
00035 #include <SString.h>
00036 
00037 namespace AcsBulkdata
00038 {
00039 
00040 
00041 class BulkDataNTCallback
00042 {
00043 public:
00044         virtual ~BulkDataNTCallback(){};
00045 
00046         // flow and stream names are set in ReceiverFlow ctor, should we keep them public ?
00047         void setFlowName (const char* name) { flowName_m =name; }
00048         const char* getFlowName () { return flowName_m.c_str(); }
00049 
00050         void setStreamName (const char* name) { streamName_m =name; }
00051         const char* getStreamName () { return streamName_m.c_str(); }
00052 
00053         void setReceiverName(ACE_CString &name) { recvName_m=name; }
00054         void setReceiverName(const char *name) { recvName_m=name; }
00055         const char* getReceiverName () { return recvName_m.c_str(); }
00056 
00061         void setCBReceiveProcessTimeout(double to);
00062 
00067         double getCBReceiveProcessTimeout() { return cbReceiveProcessTimeout_m; }
00068 
00073         void setCBReceiveAvgProcessTimeout(double to);
00074 
00079         double getCBReceiveAvgProcessTimeout() { return cbReceiveAvgProcessTimeout_m; }
00080 
00081         /*
00082     virtual void setSleepTime(ACE_Time_Value locWaitPeriod);
00083 
00084     virtual void setSafeTimeout(CORBA::ULong locLoop);
00085 
00086     virtual CORBA::Boolean isTimeout();
00087     virtual CORBA::Boolean isWorking();
00088     virtual CORBA::Boolean isError();
00089 
00090     virtual CompletionImpl *getErrorCompletion();
00091 
00092     virtual void setFlowTimeout(CORBA::ULong timeout);
00093 
00094     template<class TCallback>
00095     void setReceiver(AcsBulkdata::BulkDataReceiver<TCallback> *recv)
00096         {
00097             ACE_UNUSED_ARG(recv);
00098             //to be defined by the user
00099         }
00100 
00101 
00102     virtual void setCbTimeout(ACE_Time_Value cbTimeout)
00103         {
00104             // empty
00105         }
00106 
00107     void fwdData2UserCB(CORBA::Boolean enable);
00108          */
00109         /********************* methods that have to be implemented by the user *****************/
00110 
00111         virtual int cbStart(unsigned char* userParam_p = 0, unsigned  int size=0)=0;
00112 
00113         virtual int cbReceive(unsigned char * frame_p, unsigned  int size)=0;
00114 
00115         virtual int cbStop() = 0;
00116 
00117         /*********************  methods that can/should be  implemented by the user */
00118 
00130         virtual void onError(ACSErr::CompletionImpl &error);
00131 
00136         virtual void onSenderConnect(unsigned short totalSeners){};
00137 
00142         virtual void onSenderDisconnect(unsigned short totalSeners){};
00143 
00151         virtual void onDataLost(unsigned long frameCount, unsigned long totalFrames, ACSErr::CompletionImpl &error);
00152 protected:
00153         std::string flowName_m;
00154         std::string streamName_m;
00155 
00156         ACE_CString recvName_m;
00157 
00158         double cbReceiveProcessTimeout_m;
00159         double cbReceiveAvgProcessTimeout_m;
00160         /*
00161     bool fwdData2UserCB_m;
00162 
00163   private:
00164 
00165     void cleanRecvBuffer();
00166 
00167     void checkFlowTimeout();
00168 
00169     ACE_Time_Value waitPeriod_m;
00170 
00171     CORBA::ULong loop_m;
00172 
00173     Cb_State state_m;
00174     Cb_SubState substate_m;
00175 
00176     CORBA::Long dim_m;
00177 
00178     CORBA::Long count_m;
00179 
00180     CORBA::Long frameCount_m;
00181 
00182     ACE_Message_Block *bufParam_p;
00183 
00184     CORBA::Boolean timeout_m;
00185     CORBA::Boolean working_m;
00186     CORBA::Boolean error_m;
00187 
00188     ACSBulkDataStatus::AVCbErrorCompletion *errComp_p;
00189 
00190     CORBA::ULong flowTimeout_m;
00191 
00192     ACE_Time_Value startTime_m;    
00193 
00194     CORBA::Boolean isFepAlive_m;
00195          */
00196 };//class BulkDataNTCallback
00197 
00198 };//namespace AcsBulkdata
00199 
00200 
00201 #endif 

Generated on Mon May 4 2015 08:27:43 for ACS-2015.4 C++ API by  doxygen 1.7.0