imc::objects: preliminary complete
This commit is contained in:
parent
e952764e4f
commit
a808a001a9
@ -16,6 +16,7 @@ namespace imc
|
||||
typedef signed long int imc_Slongint;
|
||||
typedef float imc_float;
|
||||
typedef double imc_double;
|
||||
// TODO remaining types are not yet supported
|
||||
|
||||
class datatype
|
||||
{
|
||||
|
@ -8,7 +8,7 @@
|
||||
namespace imc
|
||||
{
|
||||
// start of group of keys (corresponds to key CK)
|
||||
struct group_keys
|
||||
struct keygroup
|
||||
{
|
||||
int version_;
|
||||
int length_;
|
||||
@ -25,6 +25,241 @@ namespace imc
|
||||
}
|
||||
};
|
||||
|
||||
// group definition (corresponds to key CB)
|
||||
struct group
|
||||
{
|
||||
unsigned long int group_index_;
|
||||
std::string name_;
|
||||
std::string comment_;
|
||||
|
||||
// get info string
|
||||
std::string get_info(int width = 20)
|
||||
{
|
||||
std::stringstream ss;
|
||||
ss<<std::setw(width)<<std::left<<"group-index:"<<group_index_<<"\n"
|
||||
<<std::setw(width)<<std::left<<"name:"<<name_<<"\n"
|
||||
<<std::setw(width)<<std::left<<"comment_:"<<comment_<<"\n";
|
||||
return ss.str();
|
||||
}
|
||||
};
|
||||
|
||||
// text definition (corresponds to key CT)
|
||||
struct text
|
||||
{
|
||||
unsigned long int group_index_; // corresponding to group-index in CB block
|
||||
std::string name_;
|
||||
std::string text_;
|
||||
std::string comment_;
|
||||
|
||||
// get info string
|
||||
std::string get_info(int width = 20)
|
||||
{
|
||||
std::stringstream ss;
|
||||
ss<<std::setw(width)<<std::left<<"group-index:"<<group_index_<<"\n"
|
||||
<<std::setw(width)<<std::left<<"name:"<<name_<<"\n"
|
||||
<<std::setw(width)<<std::left<<"text:"<<text_<<"\n"
|
||||
<<std::setw(width)<<std::left<<"comment_:"<<comment_<<"\n";
|
||||
return ss.str();
|
||||
}
|
||||
};
|
||||
|
||||
enum fieldtype {
|
||||
realnumber = 1, // 1
|
||||
xmonotony, // 2
|
||||
xy, // 3
|
||||
complexrealimag, // 4
|
||||
complexabsphase, // 5
|
||||
complexdbphase // 6
|
||||
};
|
||||
|
||||
// definition of data field (corresponds to key CG)
|
||||
struct datafield
|
||||
{
|
||||
unsigned long int number_components_;
|
||||
fieldtype fldtype_;
|
||||
int dimension_; // corresponding to fieldtype \in {1,}
|
||||
|
||||
// get info string
|
||||
std::string get_info(int width = 20)
|
||||
{
|
||||
std::stringstream ss;
|
||||
ss<<std::setw(width)<<std::left<<"#components:"<<number_components_<<"\n"
|
||||
<<std::setw(width)<<std::left<<"fieldtype:"<<fldtype_<<"\n"
|
||||
<<std::setw(width)<<std::left<<"dimension_:"<<dimension_<<"\n";
|
||||
return ss.str();
|
||||
}
|
||||
};
|
||||
|
||||
// definition of abscissa (corresponds to key CD1)
|
||||
struct abscissa
|
||||
{
|
||||
double dx_;
|
||||
bool calibration_;
|
||||
std::string unit_;
|
||||
|
||||
// get info string
|
||||
std::string get_info(int width = 20)
|
||||
{
|
||||
std::stringstream ss;
|
||||
ss<<std::setw(width)<<std::left<<"dx:"<<dx_<<"\n"
|
||||
<<std::setw(width)<<std::left<<"calibration_:"<<(calibration_?"yes":"no")<<"\n"
|
||||
<<std::setw(width)<<std::left<<"unit:"<<unit_<<"\n";
|
||||
return ss.str();
|
||||
}
|
||||
};
|
||||
|
||||
// start of component (corresponds to key CC)
|
||||
struct component
|
||||
{
|
||||
int component_index_;
|
||||
bool analog_digital_;
|
||||
|
||||
// get info string
|
||||
std::string get_info(int width = 20)
|
||||
{
|
||||
std::stringstream ss;
|
||||
ss<<std::setw(width)<<std::left<<"index:"<<component_index_<<"\n"
|
||||
<<std::setw(width)<<std::left<<"analog/digital_:"<<(analog_digital_?"digital":"analog")<<"\n";
|
||||
return ss.str();
|
||||
}
|
||||
};
|
||||
|
||||
enum numtype {
|
||||
unsigned_byte = 1,
|
||||
signed_byte,
|
||||
unsigned_short,
|
||||
signed_short,
|
||||
unsigned_long,
|
||||
signed_long,
|
||||
ffloat,
|
||||
ddouble,
|
||||
imc_devices_transitional_recording,
|
||||
timestamp_ascii,
|
||||
two_byte_word_digital,
|
||||
six_byte_unsigned_long
|
||||
};
|
||||
|
||||
// packaging information of component (corresponds to key CP)
|
||||
struct packaging
|
||||
{
|
||||
unsigned long int buffer_reference_;
|
||||
int bytes_;
|
||||
numtype numeric_type_;
|
||||
int signbits_;
|
||||
int mask_;
|
||||
unsigned long int offset_;
|
||||
unsigned long int number_subsequent_samples_;
|
||||
unsigned long int distance_bytes_;
|
||||
|
||||
// get info string
|
||||
std::string get_info(int width = 20)
|
||||
{
|
||||
std::stringstream ss;
|
||||
ss<<std::setw(width)<<std::left<<"buffer-reference:"<<buffer_reference_<<"\n"
|
||||
<<std::setw(width)<<std::left<<"datatype:"<<numeric_type_<<"\n"
|
||||
<<std::setw(width)<<std::left<<"significant bits:"<<signbits_<<"\n"
|
||||
<<std::setw(width)<<std::left<<"mask:"<<mask_<<"\n"
|
||||
<<std::setw(width)<<std::left<<"offset:"<<offset_<<"\n"
|
||||
<<std::setw(width)<<std::left<<"#subsequent-samples:"<<number_subsequent_samples_<<"\n"
|
||||
<<std::setw(width)<<std::left<<"distance in bytes:"<<distance_bytes_<<"\n";
|
||||
return ss.str();
|
||||
}
|
||||
};
|
||||
|
||||
// buffer description (corresponds to key Cb)
|
||||
struct buffer
|
||||
{
|
||||
unsigned long int number_buffers_;
|
||||
unsigned long int bytes_userinfo_;
|
||||
// for every single buffer
|
||||
unsigned long int buffer_reference_; // corresponds to buffer_reference_ in key CP
|
||||
unsigned long int sample_index_; // corresponds to index of CS key
|
||||
unsigned long int offset_buffer_; // number of bytes from beginning of CS key
|
||||
unsigned long int number_bytes_; // number of bytes in buffer
|
||||
unsigned long int offset_first_sample_;
|
||||
unsigned long int number_filled_bytes_;
|
||||
unsigned long int time_offset_;
|
||||
unsigned long int add_time_; // start of trigger time = NT + add_time
|
||||
bool user_info_;
|
||||
bool new_event_;
|
||||
|
||||
// get info string
|
||||
std::string get_info(int width = 20)
|
||||
{
|
||||
std::stringstream ss;
|
||||
ss<<std::setw(width)<<std::left<<"#buffers:"<<number_buffers_<<"\n"
|
||||
<<std::setw(width)<<std::left<<"bytes user info:"<<bytes_userinfo_<<"\n"
|
||||
<<std::setw(width)<<std::left<<"buffer reference:"<<buffer_reference_<<"\n"
|
||||
<<std::setw(width)<<std::left<<"sample index:"<<sample_index_<<"\n"
|
||||
<<std::setw(width)<<std::left<<"offset buffer:"<<offset_buffer_<<"\n"
|
||||
<<std::setw(width)<<std::left<<"buffer size:"<<number_bytes_<<"\n"
|
||||
<<std::setw(width)<<std::left<<"offset sample:"<<offset_first_sample_<<"\n"
|
||||
<<std::setw(width)<<std::left<<"#filled bytes:"<<number_filled_bytes_<<"\n"
|
||||
<<std::setw(width)<<std::left<<"time offset:"<<time_offset_<<"\n"
|
||||
<<std::setw(width)<<std::left<<"add time:"<<add_time_<<"\n";
|
||||
return ss.str();
|
||||
}
|
||||
};
|
||||
|
||||
// range of values of component (corresponds to key CR)
|
||||
struct range
|
||||
{
|
||||
bool transform_; // 1 = true: yes, requires offset + factor, 0 = false: no
|
||||
double factor_, offset_; // value = raw value * factor + offset
|
||||
bool calibration_; // 1 = true: calibration, 0 = false: no calibration
|
||||
std::string unit_;
|
||||
|
||||
// get info string
|
||||
std::string get_info(int width = 20)
|
||||
{
|
||||
std::stringstream ss;
|
||||
ss<<std::setw(width)<<std::left<<"transform:"<<(transform_?"yes":"no")<<"\n"
|
||||
<<std::setw(width)<<std::left<<"factor:"<<factor_<<"\n"
|
||||
<<std::setw(width)<<std::left<<"offset:"<<offset_<<"\n"
|
||||
<<std::setw(width)<<std::left<<"calibration:"<<(calibration_?"yes":"no")<<"\n"
|
||||
<<std::setw(width)<<std::left<<"unit:"<<unit_<<"\n";
|
||||
return ss.str();
|
||||
}
|
||||
};
|
||||
|
||||
// channel (corresponds to key CN)
|
||||
struct channel
|
||||
{
|
||||
unsigned long int group_index_; // corresponds to group-index in CB key
|
||||
bool index_bit_; // true = 1: digital, false = 0: analog
|
||||
std::string name_;
|
||||
std::string comment_;
|
||||
|
||||
// get info string
|
||||
std::string get_info(int width = 20)
|
||||
{
|
||||
std::stringstream ss;
|
||||
ss<<std::setw(width)<<std::left<<"group-index:"<<group_index_<<"\n"
|
||||
<<std::setw(width)<<std::left<<"index-bit:"<<index_bit_<<"\n"
|
||||
<<std::setw(width)<<std::left<<"name:"<<name_<<"\n"
|
||||
<<std::setw(width)<<std::left<<"comment:"<<comment_<<"\n";
|
||||
return ss.str();
|
||||
}
|
||||
};
|
||||
|
||||
// rawdata (corresponds to key CS)
|
||||
struct data
|
||||
{
|
||||
unsigned long int index_; // starting from 1 in first CS block in file
|
||||
// std::vector<unsigned char> rawdata_;
|
||||
unsigned long int begin_buffer_, end_buffer_;
|
||||
|
||||
// get info string
|
||||
std::string get_info(int width = 20)
|
||||
{
|
||||
std::stringstream ss;
|
||||
ss<<std::setw(width)<<std::left<<"index:"<<index_<<"\n"
|
||||
<<std::setw(width)<<std::left<<"(begin,end) buffer:"
|
||||
<<"("<<begin_buffer_<<","<<end_buffer_<<")"<<"\n";
|
||||
return ss.str();
|
||||
}
|
||||
};
|
||||
|
||||
// origin of data (corresponds to key NO)
|
||||
struct origin_data
|
||||
{
|
||||
@ -43,38 +278,18 @@ namespace imc
|
||||
}
|
||||
};
|
||||
|
||||
struct info
|
||||
// trigger timestamp (corresponds to key NT)
|
||||
struct triggertime
|
||||
{
|
||||
// timestamp of measurement
|
||||
std::string timestamp_;
|
||||
bool valid_;
|
||||
|
||||
// device and software
|
||||
std::string origin_;
|
||||
};
|
||||
|
||||
struct abscissa
|
||||
{
|
||||
// name of entity
|
||||
std::string name_;
|
||||
|
||||
// its unit
|
||||
std::string unit_;
|
||||
};
|
||||
|
||||
struct channel
|
||||
{
|
||||
// name of channel
|
||||
std::string name_;
|
||||
|
||||
// unit of channel's measurement entity
|
||||
std::string unit_;
|
||||
|
||||
// datatype of channel
|
||||
imc::datatype daty_;
|
||||
|
||||
// entity measurement depends on, i.e. channel's abscissa (mostly time)
|
||||
abscissa channel_xaxis_;
|
||||
// get info string
|
||||
std::string get_info(int width = 20)
|
||||
{
|
||||
std::stringstream ss;
|
||||
ss<<std::setw(width)<<std::left<<"timestamp:"<<timestamp_<<"\n";
|
||||
return ss.str();
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -31,9 +31,6 @@ namespace imc
|
||||
unsigned long int cplxcnt_;
|
||||
|
||||
// collect meta-information, channel definition, etc.
|
||||
imc::info imcinfo_;
|
||||
imc::channel imcchannel_;
|
||||
imc::abscissa xaxis_;
|
||||
|
||||
public:
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user