AWViz-ROS
Loading...
Searching...
No Matches
display_registry.hpp
Go to the documentation of this file.
1// Copyright 2026 Kotaro Uetake.
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15#ifndef AWVIZ_COMMON__DISPLAY_REGISTRY_HPP_
16#define AWVIZ_COMMON__DISPLAY_REGISTRY_HPP_
17
19
20#include <map>
21#include <memory>
22#include <string>
23
24namespace awviz_common
25{
32{
33public:
34 using DisplayMap = std::map<std::string, std::shared_ptr<Display>>;
35
36 DisplayRegistry() = default;
37
38 ~DisplayRegistry() = default;
39
45 bool contains(const std::string & topic) const;
46
52 std::shared_ptr<Display> get(const std::string & topic) const;
53
59 void set(const std::string & topic, std::shared_ptr<Display> display);
60
65 const DisplayMap & all() const;
66
70 void clear();
71
72private:
73 DisplayMap displays_;
74};
75} // namespace awviz_common
76
77#endif // AWVIZ_COMMON__DISPLAY_REGISTRY_HPP_
Registry to manage displays by topic name.
Definition: display_registry.hpp:32
void set(const std::string &topic, std::shared_ptr< Display > display)
Register or replace a display for a topic.
Definition: display_registry.cpp:32
const DisplayMap & all() const
Return the full registry map.
Definition: display_registry.cpp:37
std::shared_ptr< Display > get(const std::string &topic) const
Get a display for a topic.
Definition: display_registry.cpp:26
void clear()
Stop all displays and clear the registry.
Definition: display_registry.cpp:42
bool contains(const std::string &topic) const
Check if a topic is already registered.
Definition: display_registry.cpp:21
std::map< std::string, std::shared_ptr< Display > > DisplayMap
Definition: display_registry.hpp:34
Definition: display.hpp:32