15#ifndef AWVIZ_COMMON__PROPERTY_HPP_
16#define AWVIZ_COMMON__PROPERTY_HPP_
21#include <unordered_map>
40 const std::string &
type,
const std::string &
topic,
41 const std::shared_ptr<std::unordered_map<std::string, std::string>> entity_roots)
42 : type_(
type), topic_(
topic), entity_roots_(entity_roots)
63 const std::shared_ptr<std::unordered_map<std::string, std::string>> entity_roots)
65 entity_roots_ = entity_roots;
72 const std::string &
type() const noexcept {
return type_; }
78 const std::string &
topic() const noexcept {
return topic_; }
84 const std::string &
entity() const noexcept {
return topic_; }
93 std::optional<std::string>
entity(
const std::string & frame_id)
const noexcept
95 if (entity_roots_ && entity_roots_->count(frame_id) > 0) {
96 return entity_roots_->at(frame_id) + topic_;
111 if (entity_roots_ && entity_roots_->count(frame_id) > 0) {
112 return entity_roots_->at(frame_id);
118 bool is_initialized()
const {
return !type_.empty() && !topic_.empty() && entity_roots_; }
123 std::shared_ptr<std::unordered_map<std::string, std::string>>
Struct representing a property of ROS msg display instance.
Definition: property.hpp:29
const std::string & type() const noexcept
Get ROS message type.
Definition: property.hpp:72
RosTopicProperty(const std::string &type, const std::string &topic, const std::shared_ptr< std::unordered_map< std::string, std::string > > entity_roots)
Construct instance.
Definition: property.hpp:39
RosTopicProperty()=default
const std::string & topic() const noexcept
Get ROS topic name.
Definition: property.hpp:78
const std::string & entity() const noexcept
Return the entity path using topic name.
Definition: property.hpp:84
std::optional< std::string > entity(const std::string &frame_id) const noexcept
Return the entity path using the corresponding root and its frame ID with its topic.
Definition: property.hpp:93
void set_entity_roots(const std::shared_ptr< std::unordered_map< std::string, std::string > > entity_roots)
Set entity path of record.
Definition: property.hpp:62
void set_type(const std::string &type)
Set ROS message type name.
Definition: property.hpp:50
std::optional< std::string > entity_without_topic(const std::string &frame_id) const noexcept
Return the entity path using the corresponding root and its frame ID without its topic.
Definition: property.hpp:109
bool is_initialized() const
Definition: property.hpp:118
void set_topic(const std::string &topic)
Set ROS topic name.
Definition: property.hpp:56
Definition: display.hpp:30