suppress C++ output
This commit is contained in:
parent
c46194c0be
commit
53ed09967a
@ -1,8 +1,9 @@
|
|||||||
|
|
||||||
#include "tdm_ripper.hpp"
|
#include "tdm_ripper.hpp"
|
||||||
|
|
||||||
tdm_ripper::tdm_ripper(std::string tdmfile, std::string tdxfile, bool neglect_empty_groups):
|
tdm_ripper::tdm_ripper(std::string tdmfile, std::string tdxfile,
|
||||||
tdmfile_(tdmfile), tdxfile_(tdxfile),
|
bool suppress_status, bool neglect_empty_groups):
|
||||||
|
tdmfile_(tdmfile), tdxfile_(tdxfile), suppress_status_(suppress_status),
|
||||||
neglect_empty_groups_(neglect_empty_groups), num_empty_groups_(0),
|
neglect_empty_groups_(neglect_empty_groups), num_empty_groups_(0),
|
||||||
num_channels_(0), num_groups_(0), channel_id_(0), inc_id_(0), units_(0),
|
num_channels_(0), num_groups_(0), channel_id_(0), inc_id_(0), units_(0),
|
||||||
channel_name_(0), group_id_(0), group_name_(0),
|
channel_name_(0), group_id_(0), group_name_(0),
|
||||||
@ -31,13 +32,19 @@ tdm_ripper::tdm_ripper(std::string tdmfile, std::string tdxfile, bool neglect_em
|
|||||||
|
|
||||||
// setup of xml-parser
|
// setup of xml-parser
|
||||||
xml_result_ = xml_doc_.load_file(tdmfile_.c_str());
|
xml_result_ = xml_doc_.load_file(tdmfile_.c_str());
|
||||||
|
if ( !suppress_status_ )
|
||||||
|
{
|
||||||
std::cout<<"\nloading and parsing file: "<<xml_result_.description()<<"\n";
|
std::cout<<"\nloading and parsing file: "<<xml_result_.description()<<"\n";
|
||||||
std::cout<<"\nencoding: "<<(pugi::xml_encoding)xml_result_.encoding<<"\n\n";
|
std::cout<<"\nencoding: "<<(pugi::xml_encoding)xml_result_.encoding<<"\n\n";
|
||||||
|
}
|
||||||
|
|
||||||
pugi::xml_node subtreeincl = xml_doc_.child("usi:tdm").child("usi:include");
|
pugi::xml_node subtreeincl = xml_doc_.child("usi:tdm").child("usi:include");
|
||||||
|
|
||||||
|
if ( !suppress_status_ )
|
||||||
|
{
|
||||||
std::cout<<"file modified: "<<xml_doc_.child("usi:tdm").child("usi:data")
|
std::cout<<"file modified: "<<xml_doc_.child("usi:tdm").child("usi:data")
|
||||||
.child("tdm_root").child_value("datetime")<<"\n\n";
|
.child("tdm_root").child_value("datetime")<<"\n\n";
|
||||||
|
}
|
||||||
|
|
||||||
// obtain corresponding .tdx filename given in .tdm file
|
// obtain corresponding .tdx filename given in .tdm file
|
||||||
if ( tdxfile_.compare("") == 0 )
|
if ( tdxfile_.compare("") == 0 )
|
||||||
@ -55,7 +62,10 @@ tdm_ripper::tdm_ripper(std::string tdmfile, std::string tdxfile, bool neglect_em
|
|||||||
machine_endianness_ = ( *(char*)&num == 1 );
|
machine_endianness_ = ( *(char*)&num == 1 );
|
||||||
assert( machine_endianness_ == endianness_ );
|
assert( machine_endianness_ == endianness_ );
|
||||||
|
|
||||||
|
if ( !suppress_status_ )
|
||||||
|
{
|
||||||
std::cout<<"required .tdx-file is '"<<tdxfile_<<"'\n\n";
|
std::cout<<"required .tdx-file is '"<<tdxfile_<<"'\n\n";
|
||||||
|
}
|
||||||
|
|
||||||
parse_structure();
|
parse_structure();
|
||||||
|
|
||||||
@ -69,7 +79,10 @@ tdm_ripper::tdm_ripper(std::string tdmfile, std::string tdxfile, bool neglect_em
|
|||||||
(std::istreambuf_iterator<char>()));
|
(std::istreambuf_iterator<char>()));
|
||||||
tdxbuf_ = tdxbuf;
|
tdxbuf_ = tdxbuf;
|
||||||
|
|
||||||
|
if ( !suppress_status_ )
|
||||||
|
{
|
||||||
std::cout<<"number of bytes in binary file: "<<tdxbuf_.size()<<"\n\n";
|
std::cout<<"number of bytes in binary file: "<<tdxbuf_.size()<<"\n\n";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void tdm_ripper::parse_structure()
|
void tdm_ripper::parse_structure()
|
||||||
@ -162,11 +175,15 @@ void tdm_ripper::parse_structure()
|
|||||||
xml_double_sequence_.insert(std::pair<std::string,std::string>(id,val));
|
xml_double_sequence_.insert(std::pair<std::string,std::string>(id,val));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( !suppress_status_ )
|
||||||
|
{
|
||||||
std::cout<<"number of pairs in\n";
|
std::cout<<"number of pairs in\n";
|
||||||
std::cout<<std::setw(25)<<std::left<<"xml_local_columns_:"<<xml_local_columns_.size()<<"\n";
|
std::cout<<std::setw(25)<<std::left<<"xml_local_columns_:"<<xml_local_columns_.size()<<"\n";
|
||||||
std::cout<<std::setw(25)<<std::left<<"xml_values_:"<<xml_values_.size()<<"\n";
|
std::cout<<std::setw(25)<<std::left<<"xml_values_:"<<xml_values_.size()<<"\n";
|
||||||
std::cout<<std::setw(25)<<std::left<<"xml_double_sequence_:"<<xml_double_sequence_.size()<<"\n";
|
std::cout<<std::setw(25)<<std::left<<"xml_double_sequence_:"<<xml_double_sequence_.size()<<"\n";
|
||||||
std::cout<<std::right<<"\n\n";
|
std::cout<<std::right<<"\n\n";
|
||||||
|
}
|
||||||
|
|
||||||
// extract basic information about available channels
|
// extract basic information about available channels
|
||||||
// int prog = 0;
|
// int prog = 0;
|
||||||
|
@ -20,6 +20,7 @@ class tdm_ripper
|
|||||||
// .tdm and .tdx filenames
|
// .tdm and .tdx filenames
|
||||||
std::string tdmfile_;
|
std::string tdmfile_;
|
||||||
std::string tdxfile_;
|
std::string tdxfile_;
|
||||||
|
bool suppress_status_;
|
||||||
|
|
||||||
// endianness (true = little, false = big)
|
// endianness (true = little, false = big)
|
||||||
bool endianness_, machine_endianness_;
|
bool endianness_, machine_endianness_;
|
||||||
@ -61,7 +62,8 @@ class tdm_ripper
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
tdm_ripper(std::string tdmfile, std::string tdxfile = "", bool neglect_empty_groups = true);
|
tdm_ripper(std::string tdmfile, std::string tdxfile = "",
|
||||||
|
bool suppress_status = true, bool neglect_empty_groups = true);
|
||||||
|
|
||||||
void parse_structure();
|
void parse_structure();
|
||||||
|
|
||||||
|
2
main.cpp
2
main.cpp
@ -8,7 +8,7 @@ int main(int argc, char* argv[])
|
|||||||
assert( argc > 1 && "please provide a filename and path" );
|
assert( argc > 1 && "please provide a filename and path" );
|
||||||
|
|
||||||
// declare and initialize tdm_ripper
|
// declare and initialize tdm_ripper
|
||||||
tdm_ripper ripper(argv[1]);
|
tdm_ripper ripper(argv[1]); //,"samples/SineData.tdx",false);
|
||||||
|
|
||||||
// ripper.list_datatypes();
|
// ripper.list_datatypes();
|
||||||
// ripper.show_structure();
|
// ripper.show_structure();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user