Ignition Gazebo

API Reference

6.9.0
Broker.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_BROKER_HH_
19 #define IGNITION_GAZEBO_BROKER_HH_
20 
21 #include <memory>
22 
23 #include <ignition/utils/ImplPtr.hh>
24 #include <sdf/sdf.hh>
26 #include "ignition/gazebo/config.hh"
27 
28 namespace ignition
29 {
30 namespace msgs
31 {
32  // Forward declarations.
33  class Boolean;
34  class Dataframe;
35  class StringMsg_V;
36 }
37 namespace gazebo
38 {
39 // Inline bracket to help doxygen filtering.
40 inline namespace IGNITION_GAZEBO_VERSION_NAMESPACE {
41 namespace comms
42 {
43  // Forward declarations.
44  class MsgManager;
45 
85  class IGNITION_GAZEBO_VISIBLE Broker
86  {
88  public: Broker();
89 
92  public: void Load(std::shared_ptr<const sdf::Element> _sdf);
93 
98  public: void Start();
99 
102  public: std::chrono::steady_clock::duration Time() const;
103 
106  public: void SetTime(const std::chrono::steady_clock::duration &_time);
107 
117  public: bool OnBind(const ignition::msgs::StringMsg_V &_req,
119 
125  public: void OnUnbind(const ignition::msgs::StringMsg_V &_req);
126 
130  public: void OnMsg(const ignition::msgs::Dataframe &_msg);
131 
134  public: void DeliverMsgs();
135 
138  public: MsgManager &DataManager();
139 
141  public: void Lock();
142 
144  public: void Unlock();
145 
147  IGN_UTILS_UNIQUE_IMPL_PTR(dataPtr)
148  };
149 }
150 }
151 }
152 }
153 
154 #endif
A class to store messages to be delivered using a comms model. This class should be used in combinati...
Definition: Broker.hh:85
Class to handle messages and subscriptions.
Definition: MsgManager.hh:78
This library is part of the Ignition Robotics project.