4 block_names.insert(name);
8 if (name !=
nullptr) block_names.insert(std::string(name));
12: block_names(names.begin(), names.end()),
13 primary(names.size() == 0 ?
"" : *names.begin()) {}
17 if (!block_names.empty()) {
18 primary = *std::min_element(block_names.begin(), block_names.end());
27 static const std::string empty;
28 if (!primary.empty())
return primary;
29 if (block_names.empty())
return empty;
30 return *std::min_element(block_names.begin(), block_names.end());
33BlockName::operator std::string()
const {
38 return block_names.find(alias) != block_names.end();
42 return operator std::string();
46 for (
const auto& name : block_names) {
47 if (other.
hasAlias(name))
return true;
53 return !(*
this == other);
69 if (primary.empty()) primary = alias;
70 block_names.insert(alias);
75 std::unordered_set<std::string> combined;
76 for (
const auto& name : rhs.block_names) {
77 combined.insert(lhs + name);
84 for (
const auto& name : block.block_names) {
85 if (!first) os <<
"/";
93 std::unordered_set<std::string> upper_names;
94 upper_names.reserve(block_names.size());
95 for (
auto name : block_names) {
96 std::transform(name.begin(), name.end(), name.begin(), ::toupper);
97 upper_names.insert(std::move(name));
99 block_names = std::move(upper_names);
100 primary = upper_copy(primary);
104 std::set<std::string> lhs_sorted(block_names.begin(), block_names.end());
105 std::set<std::string> rhs_sorted(other.block_names.begin(), other.block_names.end());
106 return lhs_sorted < rhs_sorted;
std::ostream & operator<<(std::ostream &os, const BlockName &block)
BlockName operator+(const std::string &lhs, const BlockName &rhs)
Representation of SLHA / LHA block names with support for aliases.
Block identifier with alias support.
bool hasAlias(const std::string &alias) const
Checks whether a given alias is registered for this block.
BlockName & addAlias(const std::string &alias)
Adds a new alias to this block.
std::string to_string() const
Returns a string representation of the block name.
std::unordered_set< std::string > get_alias() const
Returns the set of aliases associated with this block.
BlockName()=default
Default constructor.
const std::string & canonical() const
bool operator!=(const BlockName &other) const
Inequality comparison between two BlockName objects.
bool operator==(const BlockName &other) const
Equality comparison between two BlockName objects.
bool operator<(const BlockName &other) const
Strict ordering operator for BlockName.
void to_upper()
Converts all aliases to upper-case in-place.