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