Gazebo Sim

API Reference

9.0.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 GZ_SIM_BROKER_HH_
19#define GZ_SIM_BROKER_HH_
20
21#include <memory>
22
23#include <gz/utils/ImplPtr.hh>
24#include <sdf/sdf.hh>
26#include "gz/sim/config.hh"
27
28namespace gz
29{
30namespace msgs
31{
32 // Forward declarations.
33 class Boolean;
34 class Dataframe;
35 class StringMsg_V;
36}
37namespace sim
38{
39// Inline bracket to help doxygen filtering.
40inline namespace GZ_SIM_VERSION_NAMESPACE {
41namespace comms
42{
43 // Forward declarations.
44 class MsgManager;
45
85 class GZ_SIM_VISIBLE Broker
86 {
88 public: Broker();
89
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 gz::msgs::StringMsg_V &_req,
118 gz::msgs::Boolean &_rep);
119
125 public: void OnUnbind(const gz::msgs::StringMsg_V &_req);
126
130 public: void OnMsg(const gz::msgs::Dataframe &_msg);
131
134 public: void DeliverMsgs();
135
139
141 public: void Lock();
142
144 public: void Unlock();
145
147 GZ_UTILS_UNIQUE_IMPL_PTR(dataPtr)
148 };
149}
150}
151}
152}
153
154#endif