// -------------------------------------------------------------------------- // #ifndef TDMDATATYPE #define TDMDATATYPE // https://zone.ni.com/reference/de-XX/help/370858P-0113/tdmdatamodel/tdmdatamodel/tdm_header_tdx_data/ // define mapping of C++ supported datatypes to tdm datatypes // define mapping of locally supported datatypes to tdm datatypes // typedef short int eInt16Usi; // typedef int eInt32Usi; // typedef unsigned char eUInt8Usi; // typedef unsigned short int eUInt16Usi; // typedef unsigned int eUInt32Usi; // typedef float eFloat32Usi; // typedef double eFloat64Usi; // enum class tdmdatatype { // eInt16Usi, // eInt32Usi, // eUInt8Usi, // eUInt16Usi, // eUInt32Usi, // eFloat32Usi, // eFloat64Usi // }; // base class for all tdm datatypes class tdmdatatype { protected: short int sint16_; int sint32_; unsigned char uint8_; unsigned short int uint16_; unsigned int uint32_; float float32_; double float64_; public: tdmdatatype(): sint16_(0), sint32_(0), uint8_(0), uint16_(0), uint32_(0), float32_(0.0), float64_(0.0) {}; virtual ~tdmdatatype() = default; friend std::ostream& operator<<(std::ostream& out, const tdmdatatype& num) { return num.print(out); } virtual std::ostream& print(std::ostream& out) const { out<<"tdmdatatype"; return out; } }; class eInt16Usi: public tdmdatatype { public: eInt16Usi() { } eInt16Usi(short int num) { sint16_ = num; } // eInt16Usi& operator=(const eInt16Usi &num) // { // // self-assignment check // if ( this != &num) // { // this->sint16_ = num.sint16_; // } // return *this; // } friend std::ostream& operator<<(std::ostream& out, const eInt16Usi& num) { return num.print(out); } std::ostream& print(std::ostream& out) const override { out< tdm_datatypes = { {"eInt16Usi","DT_SHORT",2,"short_sequence",2,"signed 16 bit integer"}, {"eInt32Usi","DT_LONG",6,"long_sequence",4,"signed 32 bit integer"}, {"eUInt8Usi","DT_BYTE",5,"byte_sequence",1,"unsigned 8 bit integer"}, {"eUInt16Usi","DT_SHORT",2,"short_sequence",2,"unsigned 16 bit integer"}, {"eUInt32Usi","DT_LONG",6,"long_sequence",4,"unsigned 32 bit integer"}, {"eFloat32Usi","DT_FLOAT",3,"float_sequence",4,"32 bit float"}, {"eFloat64Usi","DT_DOUBLE",7,"double_sequence",8,"64 bit double"}, {"eStringUsi","DT_STRING",1,"string_sequence",0,"text"} }; #endif // -------------------------------------------------------------------------- //