14 #include <type_traits> 58 virtual const std::string &GetId()
const = 0;
72 template <rpc::ActorAttributeType Type>
80 return !(*
this == rhs);
84 virtual const std::string &GetValue()
const = 0;
86 void Validate()
const;
90 bool ActorAttributeValueAccess::As<bool>()
const;
93 int ActorAttributeValueAccess::As<int>()
const;
96 float ActorAttributeValueAccess::As<float>()
const;
99 std::string ActorAttributeValueAccess::As<std::string>()
const;
105 inline auto ActorAttributeValueAccess::As<rpc::ActorAttributeType::Bool>()
const {
110 inline auto ActorAttributeValueAccess::As<rpc::ActorAttributeType::Int>()
const {
115 inline auto ActorAttributeValueAccess::As<rpc::ActorAttributeType::Float>()
const {
120 inline auto ActorAttributeValueAccess::As<rpc::ActorAttributeType::String>()
const {
121 return As<std::string>();
125 inline auto ActorAttributeValueAccess::As<rpc::ActorAttributeType::RGBColor>()
const {
126 return As<sensor::data::Color>();
129 template <
typename T>
131 return As<T>() == rhs;
145 _attribute(
std::move(attribute))
156 virtual const std::string &
GetId()
const override {
157 return _attribute.id;
161 return _attribute.type;
169 virtual const std::string &
GetValue()
const override {
170 return _attribute.value;
180 return rhs.operator==(*this);
189 _attribute(
std::move(attribute)) {
200 virtual const std::string &
GetId()
const override {
201 return _attribute.id;
205 return _attribute.type;
209 return _attribute.recommended_values;
213 return _attribute.is_modifiable;
220 void Set(std::string value);
227 virtual const std::string &
GetValue()
const override {
228 return _attribute.value;
237 return rhs.operator==(*this);
Exception thrown when the value given to an ActorAttribute cannot be converted to its type...
const std::vector< std::string > & GetRecommendedValues() const
virtual const std::string & GetId() const override
ActorAttribute(rpc::ActorAttribute attribute)
InvalidAttributeValue(const std::string &what)
BadAttributeCast(const std::string &what)
This file contains definitions of common data structures used in traffic manager. ...
virtual rpc::ActorAttributeType GetType() const override
ActorAttributeValue(rpc::ActorAttributeValue attribute)
virtual rpc::ActorAttributeType GetType() const =0
static bool operator==(const Buffer &lhs, const Buffer &rhs)
virtual const std::string & GetValue() const override
bool operator==(const T &rhs) const
bool IsModifiable() const
virtual const std::string & GetValue() const override
An attribute of an ActorBlueprint.
virtual const std::string & GetValue() const =0
bool operator!=(const T &rhs) const
Exception thrown when the value of an ActorAttribute cannot be cast to the requested type...
rpc::ActorAttributeValue _attribute
static LaneMarking::Type GetType(std::string str)
rpc::ActorAttribute _attribute
virtual rpc::ActorAttributeType GetType() const override
virtual const std::string & GetId() const override