21 template <
typename Map,
typename Container>
22 static void FillMap(
Map &destination, Container &source) {
24 destination.reserve(source.size());
26 for (
auto &item : source) {
29 destination.emplace(
id, std::move(item));
37 : _uid(definition.uid),
38 _id(
std::move(definition.id)) {
55 std::any_of(
_tags.begin(),
_tags.end(), [&](
const auto &tag) {
57 return StringUtil::Match(tag, wildcard_pattern);
73 using namespace std::string_literals;
74 throw_exception(std::out_of_range(
"attribute '"s +
id +
"' not found"));
98 for (
const auto &attribute : *
this) {
地图类的前向声明,用于在LaneInvasionSensor类中可能的引用。
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
测试是否有标签满足 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)
void throw_exception(const std::exception &e)