Gazebo Sim

API Reference

10.1.1
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
87 class GZ_SIM_VISIBLE Broker
88 {
90 public: Broker();
91
95
100 public: void Start();
101
104 public: std::chrono::steady_clock::duration Time() const;
105
108 public: void SetTime(const std::chrono::steady_clock::duration &_time);
109
119 public: bool OnBind(const gz::msgs::StringMsg_V &_req,
120 gz::msgs::Boolean &_rep);
121
127 public: void OnUnbind(const gz::msgs::StringMsg_V &_req);
128
132 public: void OnMsg(const gz::msgs::Dataframe &_msg);
133
136 public: void DeliverMsgs();
137
141
143 public: void Lock();
144
146 public: void Unlock();
147
149 GZ_UTILS_UNIQUE_IMPL_PTR(dataPtr)
150 };
151}
152}
153}
154}
155
156#endif