11#include " external_vectorpattern.hpp"
22
3- using namespace std ;
4-
53const std::regex ExternalVectorPattern::STITCH_REGEX_ = std::regex(" (corr): (.*); (position): \\ ((.*), (.*)\\ ); (grid): \\ ((.*), (.*)\\ );" ); // regex of a stitching vector line
64const std::vector<std::regex> ExternalVectorPattern::STITCH_REGEX_VECTOR_ = {std::regex (" (corr):\\ s*(.*?);" ), std::regex (" (position):\\ s*\\ ((.*?),\\ s*(.*?)\\ );" ), std::regex (" (grid):\\ s*\\ ((.*),\\ s*(.*)\\ );" )};
75const std::vector<std::string> ExternalVectorPattern::STITCH_VARIABLES_ = {" correlation" ," posX" ," posY" ," gridX" ," gridY" }; // stitching vector variables
86
9- ExternalVectorPattern::ExternalVectorPattern (const string& path, const string& file_pattern, const string& block_size, bool suppress_warnings, bool sorted):
7+ ExternalVectorPattern::ExternalVectorPattern (const std:: string& path, const std:: string& file_pattern, const std:: string& block_size, bool suppress_warnings, bool sorted):
108ExternalPattern(path, block_size, false ){
119 this ->setSuppressWarnings (suppress_warnings);
1210 this ->path_ = path; // store path to target directory
@@ -15,7 +13,7 @@ ExternalPattern(path, block_size, false){
1513 this ->setBlockSize (Block::parseblockSize (block_size));
1614
1715 this ->vector_reader_ .open (path);
18- if (!this ->vector_reader_ .is_open ()) throw invalid_argument (" Invalid path \" " + path + " \" ." );
16+ if (!this ->vector_reader_ .is_open ()) throw std:: invalid_argument (" Invalid path \" " + path + " \" ." );
1917
2018 this ->setFilePattern (file_pattern); // cast input string to regex
2119 this ->setRegexFilePattern (" " ); // Regex version of pattern
@@ -45,13 +43,13 @@ void ExternalVectorPattern::matchFiles(){
4543
4644 this ->setMapSize (this ->variables_ .size () + this ->STITCH_VARIABLES_ .size ()); // Change the size of the map to include stitching variables
4745
48- this ->setRegexExpression (regex (this ->getRegexFilePattern ()));
46+ this ->setRegexExpression (std:: regex (this ->getRegexFilePattern ()));
4947
50- string line, file;
48+ std:: string line, file;
5149 Tuple temp;
52- smatch sm;
50+ std:: smatch sm;
5351
54- while (getline (this ->vector_reader_ , line)){
52+ while (std:: getline (this ->vector_reader_ , line)){
5553 file = VectorParser::getFileName (line);
5654 if (regex_match (file, sm, this ->getRegexExpression ())){
5755 temp = getVariableMap (file, sm);
@@ -62,17 +60,17 @@ void ExternalVectorPattern::matchFiles(){
6260 this ->vector_reader_ .close ();
6361}
6462
65- string ExternalVectorPattern::inferPattern (const string& path, string& variables, const string& block_size){
63+ std:: string ExternalVectorPattern::inferPattern (const std:: string& path, std:: string& variables, const std:: string& block_size){
6664
6765 long block = Block::parseblockSize (block_size); // parse string
6866
69- vector<string> files;
70- string file;
71- ifstream infile (path);
67+ std:: vector<std:: string> files;
68+ std:: string file;
69+ std:: ifstream infile (path);
7270
73- long size = sizeof (vector<string>) + sizeof (vector<vector<int >>); // memory footprint
71+ long size = sizeof (std:: vector<std:: string>) + sizeof (std:: vector<std:: vector<int >>); // memory footprint
7472
75- string pattern = " " ;
73+ std:: string pattern = " " ;
7674 // while the stitching vector contains another line:
7775 // get block of file from stitching vector and call internal memory version of infer pattern on the block
7876 while (getline (infile, file)){
@@ -81,11 +79,11 @@ string ExternalVectorPattern::inferPattern(const string& path, string& variables
8179
8280 files.push_back (s::escape_regex_characters (file));
8381
84- size += sizeof (string) + file.length () + sizeof (int )*2 *file.length (); // account for size of filenames
82+ size += sizeof (std:: string) + file.length () + sizeof (int )*2 *file.length (); // account for size of filenames
8583
8684 if (size >= block) {
8785 pattern = inferPatternInternal (files, variables, pattern);
88- size = sizeof (vector<string>) + sizeof (vector<vector<int >>);
86+ size = sizeof (std:: vector<std:: string>) + sizeof (std:: vector<std:: vector<int >>);
8987 files.clear ();
9088 }
9189 }
0 commit comments