/*! \file gclib_record.h * Defines a union for data records. * Each supported controller has a struct member in the union with named record types. * Offsets into the data record can also be used by referencing the member `byte_array`. */ #ifndef I_210405D9_D9EF_484F_8258_BB29A1BBA217 #define I_210405D9_D9EF_484F_8258_BB29A1BBA217 //typedefs to keep the layout of the structs clean and matching the Galil user manual docs typedef unsigned char UB; //unsigned byte typedef unsigned short UW; //unsigned word typedef short SW; //signed word typedef int SL; //signed long typedef unsigned int UL; //unsigned long #if defined(_MSC_VER) || defined(__GNUC__) #pragma pack(1) #else #error "Need to set structure packing for compiler" #endif #define GALILDATARECORDMAXLENGTH 512 //!< Max size for any Galil data record, equal to dual port ram size of PCI. //! Data record struct for DMC-4000 controllers, including 4000, 4200, 4103, and 500x0. struct GDataRecord4000 { /*Offset type name description*/ /*00*/ UB header_0; //!<1st Byte of Header. /*01*/ UB header_1; //!<2nd Byte of Header. /*02*/ UB header_2; //!<3rd Byte of Header. /*03*/ UB header_3; //!<4th Byte of Header. /*04-05*/ UW sample_number; //!dmc4000.sample_number << '\n'; //access by 4000 product * cout << * ((unsigned short *) (data_record->byte_array + 4)) << '\n'; //access by pointer arithmetic * \endcode */ union GDataRecord { struct GDataRecord4000 dmc4000; //!< The DMC-4000 data record. struct GDataRecord4000 dmc4103; //!< The DMC-4103 data record. struct GDataRecord4000 dmc50000;//!< The DMC-50000 data record. struct GDataRecord30000 dmc30000;//!< The DMC-30000 data record. struct GDataRecord2103 dmc2103; //!< The DMC-21x3 data record. struct GDataRecord1806 dmc1806; //!< The DMC-1806 data record. struct GDataRecord1802 dmc1802; //!< The DMC-1802 data record. struct GDataRecord47000_ENC rio47000; //!< The RIO-471xx & 472xx data record, including encoder support. struct GDataRecord47300_ENC rio47300; //!< The RIO 473xx data record, including encoder support. struct GDataRecord47300_24EX rio47300_24ex; //!< The RIO 473xx data record, with 24EXOUT/24EXIN support. unsigned char byte_array[GALILDATARECORDMAXLENGTH]; //!< Generic byte array for offsets. }; #if defined(_MSC_VER) || defined(__GNUC__) #pragma pack() //return pack to default #else #error "Need to return structure packing for compiler" #endif #endif //I_210405D9_D9EF_484F_8258_BB29A1BBA217