$treeview $search $mathjax $extrastylesheet
otsdaq_components
v2_03_00
$projectbrief
|
$projectbrief
|
$searchbox |
00001 /* 00002 * FrontEndHardwareBase.h 00003 * 00004 * Created on: Aug 26, 2015 00005 * Author: uplegger 00006 */ 00007 00008 #ifndef _ots_FrontEndHardwareBase_h_ 00009 #define _ots_FrontEndHardwareBase_h_ 00010 00011 #include "otsdaq-core/Macros/CoutMacros.h" 00012 00013 #include <stdexcept> /*for std::runtime_error*/ 00014 #include <string> 00015 #include <vector> 00016 00017 namespace ots 00018 { 00019 class FrontEndHardwareBase 00020 { 00021 public: 00022 FrontEndHardwareBase(unsigned int version = -1) : version_(version) { ; } 00023 virtual ~FrontEndHardwareBase() { ; } 00024 00025 // These should never be called directly if used correctly, but 00026 // not all classes will implement every function (so no pure virtuals). Should be 00027 // obvious that the wrong thing is happening if these are called because exceptions 00028 // are thrown! 00029 00030 virtual void write(const std::string& sendBuffer) throw(std::runtime_error) 00031 { 00032 __SS__; 00033 __THROW__(ss.str() + "Illegal call to undefined base class member function"); 00034 } 00035 virtual void write(const std::vector<std::string>& sendBuffers) throw( 00036 std::runtime_error) 00037 { 00038 __SS__; 00039 __THROW__(ss.str() + "Illegal call to undefined base class member function"); 00040 } 00041 virtual void writeAndAcknowledge(const std::string& sendBuffer, 00042 int timeoutSeconds = -1) throw(std::runtime_error) 00043 { 00044 __SS__; 00045 __THROW__(ss.str() + "Illegal call to undefined base class member function"); 00046 } 00047 virtual void writeAndAcknowledge(const std::vector<std::string>& sendBuffers, 00048 int timeoutSeconds = -1) throw(std::runtime_error) 00049 { 00050 __SS__; 00051 __THROW__(ss.str() + "Illegal call to undefined base class member function"); 00052 } 00053 virtual void read(const std::string& sendBuffer, 00054 std::string& receiveBuffer, 00055 int timeoutSeconds = -1) throw(std::runtime_error) 00056 { 00057 __SS__; 00058 __THROW__(ss.str() + "Illegal call to undefined base class member function"); 00059 } 00060 virtual void read(const std::vector<std::string>& sendBuffers, 00061 std::vector<std::string>& receiveBuffers, 00062 int timeoutSeconds = -1) throw(std::runtime_error) 00063 { 00064 __SS__; 00065 __THROW__(ss.str() + "Illegal call to undefined base class member function"); 00066 } 00067 00068 // return count of 'things' flushed 00069 virtual int flushRead() throw(std::runtime_error) 00070 { 00071 __SS__; 00072 __THROW__(ss.str() + "Illegal call to undefined base class member function"); 00073 return 0; 00074 } 00075 00076 static const std::string PURDUE_HARDWARE_NAME; 00077 static const std::string OTS_HARDWARE_NAME; 00078 00079 protected: 00080 unsigned int version_; 00081 }; 00082 00083 const std::string FrontEndHardwareBase::PURDUE_HARDWARE_NAME = "PurdueHardware"; 00084 const std::string FrontEndHardwareBase::OTS_HARDWARE_NAME = "OtsUDPHardware"; 00085 00086 } // namespace ots 00087 00088 #endif // _ots_FrontEndHardwareBase_h_