-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reduce boost regex dependencies #30333
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||
---|---|---|---|---|
|
@@ -13,7 +13,7 @@ | |||
#include <pwd.h> | ||||
#include <climits> | ||||
// | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||
#include <boost/regex.hpp> | ||||
#include <regex> | ||||
|
||||
namespace cond { | ||||
|
||||
|
@@ -123,10 +123,10 @@ namespace cond { | |||
if (input.find("sqlite") == 0 || input.find("oracle") == 0) | ||||
return input; | ||||
|
||||
//static const boost::regex trivial("oracle://(cms_orcon_adg|cms_orcoff_prep)/([_[:alnum:]]+?)"); | ||||
static const boost::regex short_frontier("frontier://([[:alnum:]]+?)/([_[:alnum:]]+?)"); | ||||
static const boost::regex long_frontier("frontier://((\\([-[:alnum:]]+?=[^\\)]+?\\))+)/([_[:alnum:]]+?)"); | ||||
static const boost::regex long_frontier_serverurl("\\(serverurl=[^\\)]+?/([[:alnum:]]+?)\\)"); | ||||
//static const std::regex trivial("oracle://(cms_orcon_adg|cms_orcoff_prep)/([_[:alnum:]]+?)"); | ||||
static const std::regex short_frontier("frontier://([[:alnum:]]+?)/([_[:alnum:]]+?)"); | ||||
static const std::regex long_frontier("frontier://((\\([-[:alnum:]]+?=[^\\)]+?\\))+)/([_[:alnum:]]+?)"); | ||||
static const std::regex long_frontier_serverurl("\\(serverurl=[^\\)]+?/([[:alnum:]]+?)\\)"); | ||||
|
||||
static const std::map<std::string, std::string> frontierMap = { | ||||
{"PromptProd", "cms_orcon_adg"}, | ||||
|
@@ -136,23 +136,23 @@ namespace cond { | |||
{"FrontierPrep", "cms_orcoff_prep"}, | ||||
}; | ||||
|
||||
boost::smatch matches; | ||||
std::smatch matches; | ||||
|
||||
static const std::string technology("oracle://"); | ||||
std::string service(""); | ||||
std::string account(""); | ||||
|
||||
bool match = false; | ||||
if (boost::regex_match(input, matches, short_frontier)) { | ||||
if (std::regex_match(input, matches, short_frontier)) { | ||||
service = matches[1]; | ||||
account = matches[2]; | ||||
match = true; | ||||
} | ||||
|
||||
if (boost::regex_match(input, matches, long_frontier)) { | ||||
if (std::regex_match(input, matches, long_frontier)) { | ||||
std::string frontier_config(matches[1]); | ||||
boost::smatch matches2; | ||||
if (not boost::regex_search(frontier_config, matches2, long_frontier_serverurl)) | ||||
std::smatch matches2; | ||||
if (not std::regex_search(frontier_config, matches2, long_frontier_serverurl)) | ||||
throwException("No serverurl in matched long frontier", "convertoToOracleConnection"); | ||||
service = matches2[1]; | ||||
account = matches[3]; | ||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,7 +16,7 @@ | |
#include <vector> | ||
|
||
// Boost Headers | ||
#include <boost/regex.hpp> | ||
#include <regex> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could you move this header with the other standard headers above ? |
||
|
||
class FileData { | ||
public: | ||
|
@@ -89,11 +89,11 @@ class MP7FileReader { | |
std::vector<FileData> buffers_; | ||
|
||
private: | ||
static boost::regex reBoard_; | ||
static boost::regex reLink_; | ||
static boost::regex reQuadChan_; | ||
static boost::regex reFrame_; | ||
static boost::regex reValid_; | ||
static std::regex reBoard_; | ||
static std::regex reLink_; | ||
static std::regex reQuadChan_; | ||
static std::regex reFrame_; | ||
static std::regex reValid_; | ||
}; | ||
|
||
#endif /* READER_H */ |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,7 @@ | |
#include "EventFilter/L1TRawToDigi/interface/MP7FileReader.h" | ||
|
||
#include <boost/algorithm/string.hpp> | ||
#include <boost/regex.hpp> | ||
#include <regex> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could you move this header with the other standard headers below ? |
||
#include <boost/lexical_cast.hpp> | ||
|
||
#include <iostream> | ||
|
@@ -15,11 +15,11 @@ using std::cout; | |
using std::endl; | ||
|
||
// Constants initialization | ||
boost::regex MP7FileReader::reBoard_("^Board (.+)"); | ||
boost::regex MP7FileReader::reLink_("^Link : (.*)"); | ||
boost::regex MP7FileReader::reQuadChan_("^Quad/Chan : (.*)"); | ||
boost::regex MP7FileReader::reFrame_("^Frame (\\d{4}) : (.*)"); | ||
boost::regex MP7FileReader::reValid_("([01])v([0-9a-fA-F]{8})"); | ||
std::regex MP7FileReader::reBoard_("^Board (.+)"); | ||
std::regex MP7FileReader::reLink_("^Link : (.*)"); | ||
std::regex MP7FileReader::reQuadChan_("^Quad/Chan : (.*)"); | ||
std::regex MP7FileReader::reFrame_("^Frame (\\d{4}) : (.*)"); | ||
std::regex MP7FileReader::reValid_("([01])v([0-9a-fA-F]{8})"); | ||
|
||
//____________________________________________________________________________// | ||
const std::vector<uint64_t>& FileData::link(uint32_t i) const { | ||
|
@@ -116,7 +116,7 @@ void MP7FileReader::load() { | |
std::string MP7FileReader::searchBoard() { | ||
std::string line; | ||
std::string id; | ||
boost::smatch what; | ||
std::smatch what; | ||
|
||
while (getline(file_, line)) { | ||
// Trim and skip empties and comments | ||
|
@@ -126,7 +126,7 @@ std::string MP7FileReader::searchBoard() { | |
if (line[0] == '#') | ||
continue; | ||
|
||
if (boost::regex_match(line, what, reBoard_)) { | ||
if (std::regex_match(line, what, reBoard_)) { | ||
// Create a new buffer snapshot | ||
id = what[1]; | ||
return id; | ||
|
@@ -142,7 +142,7 @@ std::string MP7FileReader::searchBoard() { | |
//____________________________________________________________________________// | ||
std::vector<uint32_t> MP7FileReader::searchLinks() { | ||
std::string line; | ||
boost::smatch what; | ||
std::smatch what; | ||
|
||
while (getline(file_, line)) { | ||
boost::trim(line); | ||
|
@@ -151,12 +151,12 @@ std::vector<uint32_t> MP7FileReader::searchLinks() { | |
if (line[0] == '#') | ||
continue; | ||
|
||
if (boost::regex_match(line, what, reQuadChan_)) { | ||
if (std::regex_match(line, what, reQuadChan_)) { | ||
// Not used | ||
continue; | ||
} | ||
|
||
if (boost::regex_match(line, what, reLink_)) { | ||
if (std::regex_match(line, what, reLink_)) { | ||
std::vector<std::string> tokens; | ||
std::string tmp = what[1].str(); | ||
// Trim the line | ||
|
@@ -176,8 +176,8 @@ std::vector<uint32_t> MP7FileReader::searchLinks() { | |
} | ||
|
||
uint64_t MP7FileReader::validStrToUint64(const std::string& token) { | ||
boost::smatch what; | ||
if (!boost::regex_match(token, what, reValid_)) { | ||
std::smatch what; | ||
if (!std::regex_match(token, what, reValid_)) { | ||
throw std::logic_error("Token '" + token + "' doesn't match the valid format"); | ||
} | ||
|
||
|
@@ -189,17 +189,17 @@ uint64_t MP7FileReader::validStrToUint64(const std::string& token) { | |
//____________________________________________________________________________// | ||
std::vector<std::vector<uint64_t> > MP7FileReader::readRows() { | ||
std::string line; | ||
boost::smatch what; | ||
std::smatch what; | ||
std::vector<std::vector<uint64_t> > data; | ||
int place = file_.tellg(); | ||
while (getline(file_, line)) { | ||
if (boost::regex_match(line, what, reBoard_)) { | ||
if (std::regex_match(line, what, reBoard_)) { | ||
// Upos, next board found. Go back by one line | ||
file_.seekg(place); | ||
return data; | ||
} | ||
|
||
if (boost::regex_match(line, what, reFrame_)) { | ||
if (std::regex_match(line, what, reFrame_)) { | ||
// check frame number | ||
uint32_t n = boost::lexical_cast<uint32_t>(what[1].str()); | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,7 +13,7 @@ | |
#include "FWCore/Utilities/interface/Algorithms.h" | ||
|
||
#include "boost/algorithm/string.hpp" | ||
#include "boost/regex.hpp" | ||
#include <regex> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This file is obsolete. I suggest we let this change go in and then I remove the file (among others). Unless this PR needs to be modified for other reasons, in which case I'd ask to leave this file untouched (but only in that case). |
||
|
||
#include <algorithm> | ||
#include <iostream> // ### | ||
|
@@ -350,10 +350,10 @@ namespace edm | |
EventSelector::matching_triggers(Strings const& trigs, std::string const& s) | ||
{ | ||
std::vector< Strings::const_iterator > m; | ||
boost::regex r ( glob2reg(s) ); | ||
std::regex r ( glob2reg(s) ); | ||
for (Strings::const_iterator i = trigs.begin(); i != trigs.end(); ++i) | ||
{ | ||
if (boost::regex_match((*i),r)) | ||
if (std::regex_match((*i),r)) | ||
{ | ||
m.push_back(i); | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you move this header with the other standard headers above ?