Goby3  3.1.5a
2024.05.23
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 
31 namespace goby
32 {
33 namespace middleware
34 {
36 class 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
goby::middleware::NullTransporter::unsubscribe_dynamic
void unsubscribe_dynamic(const Group &group)
Definition: null.h:81
goby::middleware::NullTransporter
A do-nothing transporter that is always inside the last real transporter level. You will never direct...
Definition: null.h:36
goby::middleware::StaticTransporterInterface
Defines the common interface for publishing and subscribing data using static (constexpr) groups on G...
Definition: interface.h:203
goby
The global namespace for the Goby project.
Definition: acomms_constants.h:33
goby::middleware::NullTransporter::NullTransporter
NullTransporter()=default
goby::middleware::NullTransporter::publish_dynamic
void publish_dynamic(const Data &data, const Group &group, const Publisher< Data > &publisher=Publisher< Data >())
Definition: null.h:51
goby::middleware::Subscriber
Class that holds additional metadata and callback functions related to a subscription (and is optiona...
Definition: subscriber.h:36
goby::middleware::Poller
Utility class for allowing the various Goby middleware transporters to poll the underlying transport ...
Definition: poller.h:37
group
goby::util::logger::GroupSetter group(std::string n)
Definition: logger_manipulators.h:134
goby::middleware::Publisher
Class that holds additional metadata and callback functions related to a publication (and is optional...
Definition: driver_thread.h:69
goby::util::logger_lock::lock
@ lock
Definition: flex_ostreambuf.h:62
goby::middleware::MarshallingScheme::NULL_SCHEME
@ NULL_SCHEME
Definition: interface.h:51
goby::middleware::NullTransporter::publish_dynamic
void publish_dynamic(std::shared_ptr< Data > data, const Group &group, const Publisher< Data > &publisher=Publisher< Data >())
Definition: null.h:57
goby::middleware::NullTransporter::publish_dynamic
void publish_dynamic(std::shared_ptr< const Data > data, const Group &group, const Publisher< Data > &publisher=Publisher< Data >())
Definition: null.h:63
goby::middleware::NullTransporter::scheme
static constexpr int scheme()
Definition: null.h:43
goby::middleware::Group
Class for grouping publications in the Goby middleware. Analogous to "topics" in ROS,...
Definition: group.h:59
interface.h
goby::middleware::NullTransporter::check_validity
void check_validity()
Definition: null.h:48
goby::middleware::NullTransporter::subscribe_dynamic
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
goby::middleware::NullTransporter::subscribe_dynamic
void subscribe_dynamic(std::function< void(const Data &)> f, const Group &group, const Subscriber< Data > &subscriber=Subscriber< Data >())
Definition: null.h:69
goby::middleware::NullTransporter::~NullTransporter
virtual ~NullTransporter()=default
poller.h