libqi-api
2.8.7.4
|
#include <session.hpp>
Public Types | |
enum | ServiceLocality { ServiceLocality_All = 0, ServiceLocality_Local = 1, ServiceLocality_Remote = 2 } |
Public Member Functions | |
Session (bool enforceAuthentication=false, SessionConfig config={}) | |
Session (SessionConfig defaultConfig) | |
virtual | ~Session () |
const SessionConfig & | config () const |
qi::FutureSync< void > | connect () |
qi::FutureSync< void > | connect (const char *serviceDirectoryURL) |
Ignores the configuration URL and uses the given one instead. More... | |
qi::FutureSync< void > | connect (const std::string &serviceDirectoryURL) |
qi::FutureSync< void > | connect (const qi::Url &serviceDirectoryURL) |
bool | isConnected () const |
qi::Url | url () const |
qi::FutureSync< std::vector < ServiceInfo > > | services (ServiceLocality locality=ServiceLocality_All) |
qi::FutureSync< qi::AnyObject > | service (const std::string &name) |
qi::FutureSync< qi::AnyObject > | service (const std::string &name, qi::MilliSeconds timeout) |
qi::FutureSync< qi::AnyObject > | service (const std::string &name, const std::string &protocol) |
qi::FutureSync< qi::AnyObject > | service (const std::string &name, const std::string &protocol, qi::MilliSeconds timeout) |
qi::FutureSync< void > | listen () |
Uses the listen URLs from the configuration. More... | |
qi::FutureSync< void > | listen (const qi::Url &address) |
Ignores the configuration listen URLs and uses the given one instead. More... | |
qi::FutureSync< void > | listen (const std::vector< qi::Url > &addresses) |
std::vector< qi::Url > | endpoints () const |
bool | setIdentity (const std::string &key, const std::string &crt) |
qi::FutureSync< void > | close () |
qi::FutureSync< void > | listenStandalone () |
qi::FutureSync< void > | listenStandalone (const qi::Url &address) |
Ignores the configuration listen URLs and uses the given one instead. More... | |
qi::FutureSync< void > | listenStandalone (const std::vector< qi::Url > &addresses) |
Ignores the configuration listen URLs and uses the given ones instead. More... | |
qi::FutureSync< unsigned int > | registerService (const std::string &name, AnyObject object) |
qi::FutureSync< void > | unregisterService (unsigned int serviceId) |
void | setAuthProviderFactory (AuthProviderFactoryPtr) |
void | setClientAuthenticatorFactory (ClientAuthenticatorFactoryPtr) |
qi::FutureSync< unsigned int > | loadService (const std::string &moduleName, const std::string &renameModule="", const AnyReferenceVector &args=AnyReferenceVector()) |
template<typename T > | |
qi::FutureSync< T > | callModule (const std::string &moduleName, const AnyReferenceVector &args=AnyReferenceVector()) |
FutureSync< void > | waitForService (const std::string &servicename, MilliSeconds timeout) |
qi::FutureSync< void > | waitForService (const std::string &service) |
Static Public Member Functions | |
static const char * | serviceDirectoryServiceName () |
static qi::MilliSeconds | defaultServiceTimeout () |
static MilliSeconds | defaultWaitForServiceTimeout () |
Public Attributes | |
qi::Signal< unsigned int, std::string > | serviceRegistered |
qi::Signal< unsigned int, std::string > | serviceUnregistered |
qi::Signal | connected |
qi::Signal< std::string > | disconnected |
Protected Attributes | |
std::unique_ptr< SessionPrivate > | _p |
Friends | |
class | SessionPrivate |
A Session allows you to interconnect services on the same machine or over the network.
Definition at line 56 of file session.hpp.
Enumerator | |
---|---|
ServiceLocality_All | |
ServiceLocality_Local | |
ServiceLocality_Remote |
Definition at line 63 of file session.hpp.
qi::Session::Session | ( | bool | enforceAuthentication = false , |
SessionConfig | config = {} |
||
) |
|
explicit |
|
virtual |
|
inline |
Load a module and call the specified function asynchronously
Tries to call the function with (this, args...) if possible, otherwise it calls it with (args...) only.
Definition at line 165 of file session.hpp.
qi::FutureSync<void> qi::Session::close | ( | ) |
const SessionConfig& qi::Session::config | ( | ) | const |
qi::FutureSync<void> qi::Session::connect | ( | ) |
Uses the connection URL from the configuration or the hardcoded default connect URL if the first one isn't set.
qi::FutureSync<void> qi::Session::connect | ( | const char * | serviceDirectoryURL | ) |
Ignores the configuration URL and uses the given one instead.
qi::FutureSync<void> qi::Session::connect | ( | const std::string & | serviceDirectoryURL | ) |
qi::FutureSync<void> qi::Session::connect | ( | const qi::Url & | serviceDirectoryURL | ) |
|
inlinestatic |
Definition at line 88 of file session.hpp.
|
inlinestatic |
Definition at line 223 of file session.hpp.
std::vector<qi::Url> qi::Session::endpoints | ( | ) | const |
bool qi::Session::isConnected | ( | ) | const |
qi::FutureSync<void> qi::Session::listen | ( | ) |
Uses the listen URLs from the configuration.
qi::FutureSync<void> qi::Session::listen | ( | const qi::Url & | address | ) |
Ignores the configuration listen URLs and uses the given one instead.
qi::FutureSync<void> qi::Session::listen | ( | const std::vector< qi::Url > & | addresses | ) |
Ignores the configuration listen URLs and uses the given ones instead. If the parameter is empty, uses the hardcoded default listen URL.
qi::FutureSync<void> qi::Session::listenStandalone | ( | ) |
Uses the listen URLs from the configuration or the hardcoded default listen URL if the first one is empty.
qi::FutureSync<void> qi::Session::listenStandalone | ( | const qi::Url & | address | ) |
Ignores the configuration listen URLs and uses the given one instead.
qi::FutureSync<void> qi::Session::listenStandalone | ( | const std::vector< qi::Url > & | addresses | ) |
Ignores the configuration listen URLs and uses the given ones instead.
qi::FutureSync<unsigned int> qi::Session::loadService | ( | const std::string & | moduleName, |
const std::string & | renameModule = "" , |
||
const AnyReferenceVector & | args = AnyReferenceVector() |
||
) |
Load a module and register the specified object on the session
Tries to call the factory with (this, args...) if possible, otherwise it calls it with (args...) only.
qi::FutureSync<unsigned int> qi::Session::registerService | ( | const std::string & | name, |
AnyObject | object | ||
) |
|
inline |
Definition at line 93 of file session.hpp.
|
inline |
Definition at line 98 of file session.hpp.
|
inline |
Definition at line 103 of file session.hpp.
qi::FutureSync< qi::AnyObject > qi::Session::service | ( | const std::string & | name, |
const std::string & | protocol, | ||
qi::MilliSeconds | timeout | ||
) |
Returns the asked service.
If the timeout triggers, the returned future is canceled.
|
static |
qi::FutureSync< std::vector<ServiceInfo> > qi::Session::services | ( | ServiceLocality | locality = ServiceLocality_All | ) |
void qi::Session::setAuthProviderFactory | ( | AuthProviderFactoryPtr | ) |
void qi::Session::setClientAuthenticatorFactory | ( | ClientAuthenticatorFactoryPtr | ) |
bool qi::Session::setIdentity | ( | const std::string & | key, |
const std::string & | crt | ||
) |
qi::FutureSync<void> qi::Session::unregisterService | ( | unsigned int | serviceId | ) |
qi::Url qi::Session::url | ( | ) | const |
FutureSync<void> qi::Session::waitForService | ( | const std::string & | servicename, |
MilliSeconds | timeout | ||
) |
Waits for a service to become available and fails if the timeout has expired. The future is set immediately if the service is already available. The future is canceled if the timeout triggered.
qi::FutureSync<void> qi::Session::waitForService | ( | const std::string & | service | ) |
Waits for a service to become available. The future is set immediately if the service is already available. The timeout used is given by defaultWaitForServiceTimeout()
.
|
friend |
Definition at line 229 of file session.hpp.
|
protected |
Definition at line 230 of file session.hpp.
qi::Signal qi::Session::connected |
Definition at line 219 of file session.hpp.
qi::Signal<std::string> qi::Session::disconnected |
Definition at line 221 of file session.hpp.
qi::Signal<unsigned int, std::string> qi::Session::serviceRegistered |
Definition at line 216 of file session.hpp.
qi::Signal<unsigned int, std::string> qi::Session::serviceUnregistered |
Definition at line 217 of file session.hpp.