LArSoft  v07_13_02
Liquid Argon Software toolkit - http://larsoft.org/
NameStackRegistry.cc
Go to the documentation of this file.
2 #include "fhiclcpp/exception.h"
3 #include <iostream>
4 #include <regex>
5 #include <string>
6 #include <vector>
7 
8 namespace fhicl {
9 
10  std::string
11  NameStackRegistry::full_key(std::string const& name)
12  {
13  if (name.empty()) {
14  throw exception{error::other, "NameStackRegistry::full_key"}
15  << "Cannot insert empty name into 'NameStackRegistry'.\n";
16  }
17 
18  if (names_.empty() ||
19  std::regex_match(name, std::regex{R"(\[\d+\])"})) // Sequence elements
20  names_.emplace_back(name);
21  else
22  names_.emplace_back("." + name);
23  return std::accumulate(names_.begin(), names_.end(), std::string{});
24  }
25 }
26 
27 // Local variables:
28 // mode: c++
29 // End:
parameter set interface
std::string full_key(std::string const &key)
std::vector< std::string > names_
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33