- Aldebaran documentation |
- C++ Libraries |
- index

libqi-api 2.8.7.4

- Main Page
- Related Pages
- Namespaces
- Classes
- Files
- Examples

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
servicedirectoryproxy.hpp
Go to the documentation of this file.
1 #pragma once
2 /*
3 ** Copyright (C) 2018 Aldebaran Robotics
4 ** See COPYING for the license
5 */
6
7 #ifndef _QIMESSAGING_SERVICEDIRECTORYPROXY_HPP_
8 #define _QIMESSAGING_SERVICEDIRECTORYPROXY_HPP_
9
10 #include <boost/optional.hpp>
11 #include <boost/shared_ptr.hpp>
12 #include <boost/utility/string_ref.hpp>
13
14 #include <ka/functional.hpp>
15 #include <qi/anyobject.hpp> // for circular dependency with signal.hpp
16 #include <qi/anyvalue.hpp>
17 #include <qi/api.hpp>
18 #include <qi/future.hpp>
19 #include <qi/property.hpp>
20 #include <qi/signal.hpp>
21 #include <qi/url.hpp>
22
23 namespace qi
24 {
25 class AuthProviderFactory;
26 using AuthProviderFactoryPtr = boost::shared_ptr<AuthProviderFactory>;
27 class ClientAuthenticatorFactory;
28 using ClientAuthenticatorFactoryPtr = boost::shared_ptr<ClientAuthenticatorFactory>;
29
50 class QI_API ServiceDirectoryProxy
51 {
52 class Impl;
53 std::unique_ptr<Impl> _p; // must be declared before any other member
54 public:
55 enum class IdValidationStatus
56 {
57 Done,
58 PendingCheckOnListen,
59 };
60
61 enum class ListenStatus
62 {
63 NotListening,
64 Listening,
65 Starting,
66 PendingConnection,
67 };
69
70 enum class ConnectionStatus
71 {
72 NotConnected,
73 Connected,
74 Starting,
75 };
76
77 using ServiceFilter = std::function<bool(boost::string_ref)>;
78
79 struct Status
80 {
81 bool isReady() const
82 {
83 return connection == ConnectionStatus::Connected
84 && listen == ListenStatus::Listening;
85 }
86
87 bool isConnected() const { return connection == ConnectionStatus::Connected; }
88 bool isListening() const { return listen == ListenStatus::Listening; }
89
90 ConnectionStatus connection;
91 ListenStatus listen;
92 KA_GENERATE_FRIEND_REGULAR_OPS_2(Status, connection, listen);
93 };
94
95
100 ServiceDirectoryProxy(bool enforceAuth = true);
101 ~ServiceDirectoryProxy();
102
103 QI_API_DEPRECATED_MSG("Use `status` instead.")
104 Property<bool>& connected;
105
106 Property<Status>& status;
107
108 UrlVector endpoints() const;
109
110 Future<ListenStatus> listenAsync(const Url& url);
111
112 Future<IdValidationStatus> setValidateIdentity(const std::string& key, const std::string& crt);
113
114 void setAuthProviderFactory(AuthProviderFactoryPtr provider);
115 qi::Future<void> attachToServiceDirectory(const Url& serviceDirectoryUrl);
116 void close();
117
122 Future<ServiceFilter> setServiceFilter(ServiceFilter filter
123 = ka::constant_function(false));
124 };
125
126 QI_API std::ostream& operator<<(std::ostream&, ServiceDirectoryProxy::IdValidationStatus);
127 QI_API std::ostream& operator<<(std::ostream&, ServiceDirectoryProxy::ListenStatus);
128 QI_API std::ostream& operator<<(std::ostream&, ServiceDirectoryProxy::ConnectionStatus);
129
130 }
131
132 #endif // _QIMESSAGING_SERVICEDIRECTORYPROXY_HPP_
QI_API
#define QI_API
Definition: api.hpp:33
qi::ServiceDirectoryProxy::ListenStatus
ListenStatus
Definition: servicedirectoryproxy.hpp:61
qi::Future
Definition: executioncontext.hpp:20
qi::ServiceDirectoryProxy::Status::isConnected
bool isConnected() const
Definition: servicedirectoryproxy.hpp:87
qi::ServiceDirectoryProxy::ServiceFilter
std::function< bool(boost::string_ref)> ServiceFilter
Definition: servicedirectoryproxy.hpp:77
qi::ServiceDirectoryProxy::IdValidationStatus
IdValidationStatus
Definition: servicedirectoryproxy.hpp:55
api.hpp
dll import/export and compiler message
qi::ServiceDirectoryProxy::Status::isReady
bool isReady() const
Definition: servicedirectoryproxy.hpp:81
qi::ServiceDirectoryProxy::Status::connection
ConnectionStatus connection
Definition: servicedirectoryproxy.hpp:90
qi::Property
Definition: property.hpp:157
qi::AuthProviderFactoryPtr
boost::shared_ptr< AuthProviderFactory > AuthProviderFactoryPtr
Definition: authproviderfactory.hpp:36
qi::ClientAuthenticatorFactoryPtr
boost::shared_ptr< ClientAuthenticatorFactory > ClientAuthenticatorFactoryPtr
Definition: clientauthenticatorfactory.hpp:27
qi::ServiceDirectoryProxy::Status::isListening
bool isListening() const
Definition: servicedirectoryproxy.hpp:88
property.hpp
qi::ServiceDirectoryProxy::ConnectionStatus
ConnectionStatus
Definition: servicedirectoryproxy.hpp:70
url.hpp
anyvalue.hpp
qi::ServiceDirectoryProxy::Status
Definition: servicedirectoryproxy.hpp:79
QI_API_DEPRECATED_MSG
#define QI_API_DEPRECATED_MSG(msg__)
Compiler flags to mark a function as deprecated. It will generate a compiler warning.
Definition: macro.hpp:55
qi::ServiceDirectoryProxy
Definition: servicedirectoryproxy.hpp:50
future.hpp
qi::UrlVector
std::vector< Url > UrlVector
Definition: url.hpp:155
signal.hpp
qi::Url
Definition: url.hpp:35
anyobject.hpp
qi::ServiceDirectoryProxy::Status::listen
ListenStatus listen
Definition: servicedirectoryproxy.hpp:91