17 template <
typename Map,
typename Container>
18 static void FillMap(
Map &destination, Container &source) {
19 destination.reserve(source.size());
20 for (
auto &item : source) {
22 destination.emplace(
id, std::move(item));
27 : _uid(definition.uid),
28 _id(
std::move(definition.id)) {
36 std::any_of(
_tags.begin(),
_tags.end(), [&](
const auto &tag) {
37 return StringUtil::Match(tag, wildcard_pattern);
44 using namespace std::string_literals;
45 throw_exception(std::out_of_range(
"attribute '"s +
id +
"' not found"));
59 for (
const auto &attribute : *
this) {
static bool Match(const char *str, const char *wildcard_pattern)
Match str with the Unix shell-style wildcard_pattern.
static void Split(Container &destination, const Range1T &str, const Range2T &separators)
An attribute of an ActorBlueprint.
rpc::ActorDescription MakeActorDescription() const
std::unordered_map< std::string, ActorAttribute > _attributes
const ActorAttribute & GetAttribute(const std::string &id) const
std::unordered_set< std::string > _tags
ActorBlueprint(rpc::ActorDefinition actor_definition)
bool MatchTags(const std::string &wildcard_pattern) const
Test if any of the flags matches wildcard_pattern.
void SetAttribute(const std::string &id, std::string value)
Set the value of the attribute given by id.
std::vector< ActorAttribute > attributes
std::vector< ActorAttributeValue > attributes
static void FillMap(Map &destination, Container &source)
This file contains definitions of common data structures used in traffic manager.
void throw_exception(const std::exception &e)