Ignition Gazebo

API Reference

6.9.0
MsgManager.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2022 Open Source Robotics Foundation
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  */
17 
18 #ifndef IGNITION_GAZEBO_MSGMANAGER_HH_
19 #define IGNITION_GAZEBO_MSGMANAGER_HH_
20 
21 #include <deque>
22 #include <memory>
23 #include <string>
24 #include <unordered_map>
25 
27 #include <ignition/utils/ImplPtr.hh>
28 #include "ignition/gazebo/config.hh"
31 
32 namespace ignition
33 {
34 namespace msgs
35 {
36  // Forward declarations.
37  class Dataframe;
38 }
39 namespace gazebo
40 {
41 // Inline bracket to help doxygen filtering.
42 inline namespace IGNITION_GAZEBO_VERSION_NAMESPACE {
43 namespace comms
44 {
45 
48 
51 using SubscriptionHandler =
53 
56 {
59 
62 
65 
68 
71 };
72 
76 
78 class IGNITION_GAZEBO_VISIBLE MsgManager
79 {
81  public: MsgManager();
82 
91  public: bool AddSubscriber(const std::string &_address,
92  const std::string &_modelName,
93  const std::string &_topic);
94 
98  public: void AddInbound(const std::string &_address,
99  const msgs::DataframeSharedPtr &_msg);
100 
104  public: void AddOutbound(const std::string &_address,
105  const msgs::DataframeSharedPtr &_msg);
106 
111  public: bool RemoveSubscriber(const std::string &_address,
112  const std::string &_topic);
113 
118  public: bool RemoveInbound(const std::string &_address,
119  const msgs::DataframeSharedPtr &_msg);
120 
125  public: bool RemoveOutbound(const std::string &_address,
126  const msgs::DataframeSharedPtr &_msg);
127 
130  public: void DeliverMsgs();
131 
135  public: const Registry &DataConst() const;
136 
140  public: Registry &Data();
141 
145  public: Registry Copy() const;
146 
149  public: void Set(const Registry &_newContent);
150 
152  IGN_UTILS_UNIQUE_IMPL_PTR(dataPtr)
153 };
154 }
155 }
156 }
157 }
158 
159 #endif
All the information associated to an address.
Definition: MsgManager.hh:55
DataQueue inboundMsgs
Queue of inbound messages.
Definition: MsgManager.hh:58
DataQueue outboundMsgs
Queue of outbound messages.
Definition: MsgManager.hh:61
STL class.
std::string modelName
Model name associated to this address.
Definition: MsgManager.hh:67
gazebo::Entity entity
Entity of the model associated to this address.
Definition: MsgManager.hh:70
Class to handle messages and subscriptions.
Definition: MsgManager.hh:78
void Set(msgs::Vector3d *_pt, const ignition::math::Vector3d &_v)
This library is part of the Ignition Robotics project.
uint64_t Entity
An Entity identifies a single object in simulation such as a model, link, or light. At its core, an Entity is just an identifier.
Definition: Entity.hh:59
SubscriptionHandler subscriptions
Subscribers.
Definition: MsgManager.hh:64