full tdm datamodel overview
This commit is contained in:
parent
cecb53fe85
commit
fe19f723b3
@ -354,7 +354,7 @@ struct submatrix {
|
|||||||
const std::string get_info() { return get_info(defformat); }
|
const std::string get_info() { return get_info(defformat); }
|
||||||
const std::string get_info(format& formatter)
|
const std::string get_info(format& formatter)
|
||||||
{
|
{
|
||||||
formatter.set_columns({ std::make_pair("id",id_),
|
formatter.set_columns({ std::make_pair("submatrix-id",id_),
|
||||||
std::make_pair("name",name_),
|
std::make_pair("name",name_),
|
||||||
std::make_pair("description",description_),
|
std::make_pair("description",description_),
|
||||||
std::make_pair("measurement",measurement_),
|
std::make_pair("measurement",measurement_),
|
||||||
@ -399,7 +399,7 @@ struct localcolumn {
|
|||||||
const std::string get_info() { return get_info(defformat); }
|
const std::string get_info() { return get_info(defformat); }
|
||||||
const std::string get_info(format& formatter)
|
const std::string get_info(format& formatter)
|
||||||
{
|
{
|
||||||
formatter.set_columns({ std::make_pair("id",id_),
|
formatter.set_columns({ std::make_pair("localcolumn-id",id_),
|
||||||
std::make_pair("name",name_),
|
std::make_pair("name",name_),
|
||||||
std::make_pair("description",description_),
|
std::make_pair("description",description_),
|
||||||
std::make_pair("measurement_quantity",measurement_quantity_),
|
std::make_pair("measurement_quantity",measurement_quantity_),
|
||||||
|
@ -395,9 +395,6 @@ void tdm_reaper::process_localcolumns(bool showlog)
|
|||||||
|
|
||||||
std::string tdm_reaper::get_channel_overview(format chformatter)
|
std::string tdm_reaper::get_channel_overview(format chformatter)
|
||||||
{
|
{
|
||||||
// declare format instance
|
|
||||||
// format chformatter(15,false,false,' ');
|
|
||||||
|
|
||||||
// summarize all output in single string
|
// summarize all output in single string
|
||||||
std::string channels_summary;
|
std::string channels_summary;
|
||||||
|
|
||||||
@ -434,6 +431,66 @@ std::string tdm_reaper::get_channel_overview(format chformatter)
|
|||||||
return channels_summary;
|
return channels_summary;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string tdm_reaper::get_submatrix_overview(format formatter)
|
||||||
|
{
|
||||||
|
// summarize all output in single string
|
||||||
|
std::string submatrix_summary;
|
||||||
|
|
||||||
|
// set tabular mode of formatter
|
||||||
|
formatter.set_tabular(true);
|
||||||
|
|
||||||
|
// compose header
|
||||||
|
formatter.set_header(true);
|
||||||
|
submatrix sbm;
|
||||||
|
submatrix_summary += sbm.get_info(formatter);
|
||||||
|
std::string rule;
|
||||||
|
for ( unsigned long int i = 0; i < submatrix_summary.size(); i++ )
|
||||||
|
{
|
||||||
|
rule += std::string("-");
|
||||||
|
}
|
||||||
|
submatrix_summary += std::string("\n") + rule + std::string("\n");
|
||||||
|
|
||||||
|
formatter.set_header(false);
|
||||||
|
for (std::map<std::string,submatrix>::iterator it=submatrices_.begin();
|
||||||
|
it!=submatrices_.end(); ++it)
|
||||||
|
{
|
||||||
|
submatrix_summary += it->second.get_info(formatter);
|
||||||
|
submatrix_summary += std::string("\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
return submatrix_summary;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string tdm_reaper::get_localcolumn_overview(format formatter)
|
||||||
|
{
|
||||||
|
// summarize all output in single string
|
||||||
|
std::string summary;
|
||||||
|
|
||||||
|
// set tabular mode of formatter
|
||||||
|
formatter.set_tabular(true);
|
||||||
|
|
||||||
|
// compose header
|
||||||
|
formatter.set_header(true);
|
||||||
|
localcolumn lc;
|
||||||
|
summary += lc.get_info(formatter);
|
||||||
|
std::string rule;
|
||||||
|
for ( unsigned long int i = 0; i < summary.size(); i++ )
|
||||||
|
{
|
||||||
|
rule += std::string("-");
|
||||||
|
}
|
||||||
|
summary += std::string("\n") + rule + std::string("\n");
|
||||||
|
|
||||||
|
formatter.set_header(false);
|
||||||
|
for (std::map<std::string,localcolumn>::iterator it=localcolumns_.begin();
|
||||||
|
it!=localcolumns_.end(); ++it)
|
||||||
|
{
|
||||||
|
summary += it->second.get_info(formatter);
|
||||||
|
summary += std::string("\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
return summary;
|
||||||
|
}
|
||||||
|
|
||||||
// -------------------------------------------------------------------------- //
|
// -------------------------------------------------------------------------- //
|
||||||
|
|
||||||
std::vector<double> tdm_reaper::get_channel(std::string &id)
|
std::vector<double> tdm_reaper::get_channel(std::string &id)
|
||||||
@ -477,6 +534,9 @@ void tdm_reaper::print_channel(std::string &id, const char* filename)
|
|||||||
fou.close();
|
fou.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// -------------------------------------------------------------------------- //
|
||||||
|
|
||||||
template<typename datatype>
|
template<typename datatype>
|
||||||
void tdm_reaper::convert_data_to_type(std::vector<unsigned char> &buffer,
|
void tdm_reaper::convert_data_to_type(std::vector<unsigned char> &buffer,
|
||||||
std::vector<datatype> &channel)
|
std::vector<datatype> &channel)
|
||||||
|
@ -149,6 +149,10 @@ public:
|
|||||||
// get full channel(group) overview
|
// get full channel(group) overview
|
||||||
std::string get_channel_overview(format chformatter);
|
std::string get_channel_overview(format chformatter);
|
||||||
|
|
||||||
|
// get submatrix/localcolumn overview
|
||||||
|
std::string get_submatrix_overview(format formatter);
|
||||||
|
std::string get_localcolumn_overview(format formatter);
|
||||||
|
|
||||||
// get list of channelgroup ids
|
// get list of channelgroup ids
|
||||||
std::vector<std::string> get_channelgroup_ids()
|
std::vector<std::string> get_channelgroup_ids()
|
||||||
{
|
{
|
||||||
|
@ -179,14 +179,14 @@ int main(int argc, char* argv[])
|
|||||||
// declare and initialize tdm_ripper instance
|
// declare and initialize tdm_ripper instance
|
||||||
tdm_reaper jack;
|
tdm_reaper jack;
|
||||||
try {
|
try {
|
||||||
jack.submit_files(cfgopts.at("tdm"),cfgopts.at("tdx"),true);
|
jack.submit_files(cfgopts.at("tdm"),cfgopts.at("tdx"),false);
|
||||||
} catch (const std::exception& e) {
|
} catch (const std::exception& e) {
|
||||||
throw std::runtime_error( std::string("failed to load/parse tdm/tdx files: ")
|
throw std::runtime_error( std::string("failed to load/parse tdm/tdx files: ")
|
||||||
+ e.what() );
|
+ e.what() );
|
||||||
}
|
}
|
||||||
|
|
||||||
// check available datatypes on machine
|
// check available datatypes on machine
|
||||||
jack.check_local_datatypes();
|
// jack.check_local_datatypes();
|
||||||
|
|
||||||
// show some meta data of the dataset
|
// show some meta data of the dataset
|
||||||
std::cout<<"\n"<<jack.get_root().get_info()<<"\n\n";
|
std::cout<<"\n"<<jack.get_root().get_info()<<"\n\n";
|
||||||
@ -195,6 +195,11 @@ int main(int argc, char* argv[])
|
|||||||
format chformatter(14,false,false,' ');
|
format chformatter(14,false,false,' ');
|
||||||
std::cout<<jack.get_channel_overview(chformatter)<<"\n";
|
std::cout<<jack.get_channel_overview(chformatter)<<"\n";
|
||||||
|
|
||||||
|
// get complete submatrix/localcolumns overview
|
||||||
|
format formatter(18,false,false,' ');
|
||||||
|
std::cout<<jack.get_submatrix_overview(formatter)<<"\n";
|
||||||
|
std::cout<<jack.get_localcolumn_overview(formatter)<<"\n";
|
||||||
|
|
||||||
// std::vector<std::string> chgrids = jack.get_channelgroup_ids();
|
// std::vector<std::string> chgrids = jack.get_channelgroup_ids();
|
||||||
// for ( auto el: chgrids ) std::cout<<el<<",";
|
// for ( auto el: chgrids ) std::cout<<el<<",";
|
||||||
// std::cout<<"\n";
|
// std::cout<<"\n";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user