// ------------------------------------------------------------------------- // #ifndef TDM_REAPER #define TDM_REAPER #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "pugixml.hpp" #include "tdm_datamodel.hpp" // -------------------------------------------------------------------------- // class tdm_reaper { // .tdm and .tdx paths/filenames std::string tdmfile_; std::string tdxfile_; // set of .csv files (encoding mode) std::vector csvfile_; // XML parser pugi::xml_document xml_doc_; pugi::xml_parse_result xml_result_; // endianness (true = little, false = big) bool endianness_, machine_endianness_; // blocks of data in .tdx file std::map tdx_blocks_; // tdm root tdm_root tdmroot_; // tdm channelgroups std::map tdmchannelgroups_; // tdm channels std::map tdmchannels_; // submatrices and local_columns std::map submatrices_; std::map localcolumns_; // // binary data container // std::vector tdxbuf_; // extract list of identifiers from e.g. "#xpointer(id("usi12") id("usi13"))" std::vector extract_ids(std::string idstring) { // collect group identifiers by means of regex pattern "usi[0-9]+" std::regex regid("(usi[0-9]+)"); // declare match instance and regex iterator (to find ALL matches) std::smatch usi_match; std::sregex_iterator pos(idstring.begin(), idstring.end(), regid); std::sregex_iterator end; // iterate through all matches std::vector listofids; for ( ; pos != end; ++pos) listofids.push_back(pos->str()); return listofids; } public: // encoding tdm_reaper(std::vector csvfile); // decoding tdm_reaper(); tdm_reaper(std::string tdmfile, std::string tdxfile = std::string(""), bool showlog = false); // provide (tdm,tdx) files void submit_files(std::string tdmfile, std::string tdxfile = std::string(""), bool showlog = false); // process TDM data model in tdm file void process_tdm(bool showlog); // process element void process_include(bool showlog); // extract tdm_root void process_root(bool showlog); // process/list all channels and groups void process_channelgroups(bool showlog); void process_channels(bool showlog); // process submatrices and localcolumns void process_submatrices(bool showlog); void process_localcolumns(bool showlog); }; #endif // -------------------------------------------------------------------------- //