20 #include <momemta/InputTag.h> 22 std::vector<std::string> split(
const std::string& s,
const std::string& delimiters) {
24 std::vector<std::string> result;
30 next = s.find_first_not_of(delimiters, next + 1);
31 if (next == std::string::npos)
36 next = s.find_first_of(delimiters, current);
37 result.push_back(s.substr(current, next - current));
39 while (next != std::string::npos);
45 module(module), parameter(parameter) {
46 string_representation = module +
"::" +
parameter;
50 module(module), parameter(parameter), index(index), indexed(true) {
51 string_representation = module +
"::" + parameter +
"/" + std::to_string(index + 1);
55 if (tag.find(
"::") == std::string::npos)
58 if (tag.find(
"/") != std::string::npos) {
59 auto tags = split(tag,
"::");
60 auto rtags = split(tags[1],
"/");
62 int64_t
index = std::stoll(rtags[1]) - 1;
67 }
catch (
const std::invalid_argument& e) {
76 auto tags = split(tag,
"::");
77 auto rtags = split(tags[1],
"/");
79 if (rtags.size() == 1)
82 return InputTag(tags[0], rtags[0], std::stoull(rtags[1]) - 1);
90 return string_representation;
104 string_representation +=
"/" + std::to_string(
index + 1);