YARP
Yet Another Robot Platform
SubscriberOnSql.h
Go to the documentation of this file.
1 /*
2  * SPDX-FileCopyrightText: 2006-2021 Istituto Italiano di Tecnologia (IIT)
3  * SPDX-FileCopyrightText: 2006-2010 RobotCub Consortium
4  * SPDX-License-Identifier: BSD-3-Clause
5  */
6 
7 #ifndef YARP_SERVERSQL_IMPL_SUBSCRIBERONSQL_H
8 #define YARP_SERVERSQL_IMPL_SUBSCRIBERONSQL_H
9 
11 
12 #include <mutex>
13 
14 
15 namespace yarp {
16 namespace serversql {
17 namespace impl {
18 
23 {
24 public:
26  {
27  implementation = nullptr;
28  }
29 
30  ~SubscriberOnSql() override
31  {
32  if (implementation != nullptr) {
33  close();
34  }
35  }
36 
37  bool open(const std::string& filename, bool fresh = false);
38 
39  bool close();
40 
41  bool addSubscription(const std::string& src,
42  const std::string& dest,
43  const std::string& mode) override;
44 
45  bool removeSubscription(const std::string& src,
46  const std::string& dest) override;
47 
48  bool listSubscriptions(const std::string& port,
49  yarp::os::Bottle& reply) override;
50 
51  bool welcome(const std::string& port, int activity) override;
52 
53  bool hookup(const std::string& port);
54 
55  bool breakdown(const std::string& port);
56 
57  bool setTopic(const std::string& port,
58  const std::string& structure, bool active) override;
59 
60  bool listTopics(yarp::os::Bottle& topics) override;
61 
62  bool transitiveWelcome(const std::string& topic,
63  const std::string& src,
64  const std::string& dest,
65  const std::string& srcFull,
66  const std::string& destFull);
67 
68  bool checkSubscription(const std::string& src,
69  const std::string& dest,
70  const std::string& srcFull,
71  const std::string& destFull,
72  const std::string& mode);
73 
74  bool breakSubscription(const std::string& dropper,
75  const std::string& src,
76  const std::string& dest,
77  const std::string& srcFull,
78  const std::string& destFull,
79  const std::string& mode);
80 
81  bool setType(const std::string& family,
82  const std::string& structure,
83  const std::string& value) override;
84 
85  std::string getType(const std::string& family,
86  const std::string& structure) override;
87 
88 private:
89  void *implementation {nullptr};
90  std::mutex mutex;
91 };
92 
93 } // namespace impl
94 } // namespace serversql
95 } // namespace yarp
96 
97 
98 #endif // YARP_SERVERSQL_IMPL_SUBSCRIBERONSQL_H
A simple collection of objects that can be described and transmitted in a portable way.
Definition: Bottle.h:74
Interface for maintaining persistent connections using SQL.
bool checkSubscription(const std::string &src, const std::string &dest, const std::string &srcFull, const std::string &destFull, const std::string &mode)
bool removeSubscription(const std::string &src, const std::string &dest) override
bool open(const std::string &filename, bool fresh=false)
bool transitiveWelcome(const std::string &topic, const std::string &src, const std::string &dest, const std::string &srcFull, const std::string &destFull)
bool hookup(const std::string &port)
bool welcome(const std::string &port, int activity) override
bool breakSubscription(const std::string &dropper, const std::string &src, const std::string &dest, const std::string &srcFull, const std::string &destFull, const std::string &mode)
bool addSubscription(const std::string &src, const std::string &dest, const std::string &mode) override
bool listSubscriptions(const std::string &port, yarp::os::Bottle &reply) override
std::string getType(const std::string &family, const std::string &structure) override
bool breakdown(const std::string &port)
bool setTopic(const std::string &port, const std::string &structure, bool active) override
bool listTopics(yarp::os::Bottle &topics) override
bool setType(const std::string &family, const std::string &structure, const std::string &value) override
Abstract interface for maintaining persistent connections.
Definition: Subscriber.h:28
The main, catch-all namespace for YARP.
Definition: dirs.h:16