Goby3 3.2.3
2025.05.13
Loading...
Searching...
No Matches
null.h
Go to the documentation of this file.
1// Copyright 2019-2021:
2// GobySoft, LLC (2013-)
3// Community contributors (see AUTHORS file)
4// File authors:
5// Toby Schneider <toby@gobysoft.org>
6//
7//
8// This file is part of the Goby Underwater Autonomy Project Libraries
9// ("The Goby Libraries").
10//
11// The Goby Libraries are free software: you can redistribute them and/or modify
12// them under the terms of the GNU Lesser General Public License as published by
13// the Free Software Foundation, either version 2.1 of the License, or
14// (at your option) any later version.
15//
16// The Goby Libraries are distributed in the hope that they will be useful,
17// but WITHOUT ANY WARRANTY; without even the implied warranty of
18// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19// GNU Lesser General Public License for more details.
20//
21// You should have received a copy of the GNU Lesser General Public License
22// along with Goby. If not, see <http://www.gnu.org/licenses/>.
23
24#ifndef GOBY_MIDDLEWARE_TRANSPORT_NULL_H
25#define GOBY_MIDDLEWARE_TRANSPORT_NULL_H
26
28
29#include "interface.h"
30
31namespace goby
32{
33namespace middleware
34{
36class NullTransporter : public StaticTransporterInterface<NullTransporter, NullTransporter>,
37 public Poller<NullTransporter>
38{
39 public:
40 NullTransporter() = default;
41 virtual ~NullTransporter() = default;
42
43 template <typename Data> static constexpr int scheme()
44 {
46 }
47
48 template <const Group& group> void check_validity() {}
49
50 template <typename Data, int scheme = scheme<Data>()>
51 void publish_dynamic(const Data& data, const Group& group,
52 const Publisher<Data>& publisher = Publisher<Data>())
53 {
54 }
55
56 template <typename Data, int scheme = scheme<Data>()>
57 void publish_dynamic(std::shared_ptr<Data> data, const Group& group,
58 const Publisher<Data>& publisher = Publisher<Data>())
59 {
60 }
61
62 template <typename Data, int scheme = scheme<Data>()>
63 void publish_dynamic(std::shared_ptr<const Data> data, const Group& group,
64 const Publisher<Data>& publisher = Publisher<Data>())
65 {
66 }
67
68 template <typename Data, int scheme = scheme<Data>()>
69 void subscribe_dynamic(std::function<void(const Data&)> f, const Group& group,
70 const Subscriber<Data>& subscriber = Subscriber<Data>())
71 {
72 }
73
74 template <typename Data, int scheme = scheme<Data>()>
75 void subscribe_dynamic(std::function<void(std::shared_ptr<const Data>)> f, const Group& group,
76 const Subscriber<Data>& subscriber = Subscriber<Data>())
77 {
78 }
79
80 template <typename Data, int scheme = scheme<Data>()>
82 {
83 }
84
85 private:
87 int _poll(std::unique_ptr<std::unique_lock<std::timed_mutex> >& lock) { return 0; }
88};
89} // namespace middleware
90} // namespace goby
91
92#endif
Class for grouping publications in the Goby middleware. Analogous to "topics" in ROS,...
Definition group.h:60
A do-nothing transporter that is always inside the last real transporter level. You will never direct...
Definition null.h:38
void publish_dynamic(std::shared_ptr< Data > data, const Group &group, const Publisher< Data > &publisher=Publisher< Data >())
Definition null.h:57
void publish_dynamic(std::shared_ptr< const Data > data, const Group &group, const Publisher< Data > &publisher=Publisher< Data >())
Definition null.h:63
void unsubscribe_dynamic(const Group &group)
Definition null.h:81
void publish_dynamic(const Data &data, const Group &group, const Publisher< Data > &publisher=Publisher< Data >())
Definition null.h:51
virtual ~NullTransporter()=default
void subscribe_dynamic(std::function< void(std::shared_ptr< const Data >)> f, const Group &group, const Subscriber< Data > &subscriber=Subscriber< Data >())
Definition null.h:75
void subscribe_dynamic(std::function< void(const Data &)> f, const Group &group, const Subscriber< Data > &subscriber=Subscriber< Data >())
Definition null.h:69
static constexpr int scheme()
Definition null.h:43
Utility class for allowing the various Goby middleware transporters to poll the underlying transport ...
Definition poller.h:38
Class that holds additional metadata and callback functions related to a publication (and is optional...
Definition publisher.h:40
Defines the common interface for publishing and subscribing data using static (constexpr) groups on G...
Definition interface.h:204
Class that holds additional metadata and callback functions related to a subscription (and is optiona...
Definition subscriber.h:37
goby::util::logger::GroupSetter group(std::string n)
The global namespace for the Goby project.