00001 00010 #ifndef _BASE_INSTRUMENT_HH_ 00011 #define _BASE_INSTRUMENT_HH_ 00012 00013 00014 // C/C++ includes 00015 #include <string> 00016 #include <map> 00017 00018 00019 class BaseInstrument 00020 { 00021 public: 00022 00024 enum InstrumentType_t 00025 { 00026 POWER_SUPPLY =0, 00027 DIGITALMM =1, 00028 OSCILLOSCOPE =3, 00029 FUN_GENERATOR=4 00030 }; 00031 00032 00033 00041 BaseInstrument(const std::string name, const std::string vendor, InstrumentType_t inst); 00042 00043 00047 virtual ~BaseInstrument(); 00048 00049 00053 inline const InstrumentType_t GetInstrumentCode() const {return f_type;} 00054 00058 inline const std::string& GetInstrumentDes() const {return g_instruments[GetInstrumentCode()];} 00059 00063 inline const std::string& GetName() const {return f_name;} 00064 00068 inline const std::string& GetVendor() const {return f_vendor;} 00069 00070 00074 virtual std::string GetIDN()=0; 00075 00076 00080 virtual bool IsError() const =0; 00081 00086 virtual size_t GetErrorCode() const =0; 00087 00088 00094 virtual const std::string& GetErrorMsg() const =0; 00095 00096 00097 protected: 00098 00099 00100 00101 private: 00102 00103 const std::string f_name; 00104 const std::string f_vendor; 00106 const InstrumentType_t f_type; 00109 static std::map<InstrumentType_t, std::string> g_instruments; 00110 }; 00111 00112 #endif // _BASE_INSTRUMENT_HH_ 00113