• 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.16 2011/11/09 12:01:36 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 
00057         /*
00058     virtual void setSleepTime(ACE_Time_Value locWaitPeriod);
00059 
00060     virtual void setSafeTimeout(CORBA::ULong locLoop);
00061 
00062     virtual CORBA::Boolean isTimeout();
00063     virtual CORBA::Boolean isWorking();
00064     virtual CORBA::Boolean isError();
00065 
00066     virtual CompletionImpl *getErrorCompletion();
00067 
00068     virtual void setFlowTimeout(CORBA::ULong timeout);
00069 
00070     template<class TCallback>
00071     void setReceiver(AcsBulkdata::BulkDataReceiver<TCallback> *recv)
00072         {
00073             ACE_UNUSED_ARG(recv);
00074             //to be defined by the user
00075         }
00076 
00077 
00078     virtual void setCbTimeout(ACE_Time_Value cbTimeout)
00079         {
00080             // empty
00081         }
00082 
00083     void fwdData2UserCB(CORBA::Boolean enable);
00084          */
00085         /********************* methods that have to be implemented by the user *****************/
00086 
00087         virtual int cbStart(unsigned char* userParam_p = 0, unsigned  int size=0)=0;
00088 
00089         virtual int cbReceive(unsigned char * frame_p, unsigned  int size)=0;
00090 
00091         virtual int cbStop() = 0;
00092 
00093         /*********************  methods that can/should be  implemented by the user */
00094 
00096         virtual void onError(ACSErr::CompletionImpl &error);
00097 
00099         virtual void onSenderConnect(){};
00100 
00102         virtual void onSenderDisconnect(){};
00103 
00104         //TBD: to be implemented now those error goes to onError
00105         virtual void onDataLost(unsigned long frmaeCount, unsigned long totalFrames, ACSErr::CompletionImpl &error){};
00106 protected:
00107         std::string flowName_m;
00108         std::string streamName_m;
00109 
00110         ACE_CString recvName_m;
00111         /*
00112     bool fwdData2UserCB_m;
00113 
00114   private:
00115 
00116     void cleanRecvBuffer();
00117 
00118     void checkFlowTimeout();
00119 
00120     ACE_Time_Value waitPeriod_m;
00121 
00122     CORBA::ULong loop_m;
00123 
00124     Cb_State state_m;
00125     Cb_SubState substate_m;
00126 
00127     CORBA::Long dim_m;
00128 
00129     CORBA::Long count_m;
00130 
00131     CORBA::Long frameCount_m;
00132 
00133     ACE_Message_Block *bufParam_p;
00134 
00135     CORBA::Boolean timeout_m;
00136     CORBA::Boolean working_m;
00137     CORBA::Boolean error_m;
00138 
00139     ACSBulkDataStatus::AVCbErrorCompletion *errComp_p;
00140 
00141     CORBA::ULong flowTimeout_m;
00142 
00143     ACE_Time_Value startTime_m;    
00144 
00145     CORBA::Boolean isFepAlive_m;
00146          */
00147 };//class BulkDataNTCallback
00148 
00149 };//namespace AcsBulkdata
00150 
00151 
00152 #endif 

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