|
| ApplicationSession (int &argc, char **&argv, int opt=0, const Url &defaultUrl=SessionConfig::defaultConnectUrl()) |
| Constructors of the class. More...
|
|
| ApplicationSession (const std::string &name, int &argc, char **&argv, int opt=0, const Url &defaultUrl=SessionConfig::defaultConnectUrl()) |
|
| ApplicationSession (int &argc, char **&argv, const Config &defaultConfig) |
|
virtual | ~ApplicationSession () |
|
SessionPtr | session () const |
|
const Config & | config () const |
|
Url | url () const |
|
Url | listenUrl () const |
|
std::vector< Url > | allListenUrl () const |
|
void | start () |
|
void | startSession () |
|
void | run () |
|
bool | standAlone () |
|
std::string | helpText () const |
|
| Application (int &argc, char **&argv, const std::string &name="", const std::string &path="") |
| Application constructor. Must be the first thing called by main(). More...
|
|
| Application (const std::string &name, int &argc, char **&argv) |
| Application constructor. Must be the first thing called by main(). More...
|
|
| ~Application () |
| Application destructor. It executes atExit() callbacks. More...
|
|
| Application (const Application &)=delete |
|
Application & | operator= (const Application &)=delete |
|
|
static void | run () |
| Wait until the end of the program. More...
|
|
static void | stop () |
| Stop the application. Call all atStop handlers. More...
|
|
static const std::vector
< std::string > & | arguments () |
| Get arguments of the program as an std::vector of std::string. More...
|
|
static int | argc () |
| Get argument counter of the program. More...
|
|
static const char ** | argv () |
| Get string arguments of the program (including program name). More...
|
|
static void | setName (const std::string &name) |
| Set application name. More...
|
|
static std::string | name () |
| Get application name. More...
|
|
static void | setArguments (int argc, char **argv) |
| Set arguments of the program with argc as argument counter and argv as argument values. More...
|
|
static void | setArguments (const std::vector< std::string > &arguments) |
| Set arguments ot the program as an std::vector of std::string. More...
|
|
static void * | loadModule (const std::string &name, int flags=-1) |
| Load a module into the current process. More...
|
|
static void | unloadModule (void *handle) |
| Unload a module from the current process. More...
|
|
static bool | terminated () |
| Check whether the Application instance is terminated or not. More...
|
|
static bool | initialized () |
| Check whether the Application instance was initialized or not. More...
|
|
static const char * | program () |
| Return the current program full path according to argv[0]. More...
|
|
static const char * | realProgram () |
| Return the current program full path. More...
|
|
static const char * | _suggestedSdkPath () |
| Return the SDK path given through –qi-sdk-prefix or QI_SDK_PREFIX. More...
|
|
static bool | atEnter (std::function< void()> func) |
| Register a function to be executed at Application creation. More...
|
|
static bool | atExit (std::function< void()> func) |
| Register a function to be executed at Application destruction. More...
|
|
static bool | atRun (std::function< void()> func) |
| Register a function to be executed when run() is called. The functions are executed sequentially at the beginning of run(). More...
|
|
static bool | atStop (std::function< void()> func) |
| Register a function to be executed when stop() is called. The functions are executed sequentially before run() returns. More...
|
|
static bool | atSignal (std::function< void(int)> func, int signal) |
| Register a function to be executed when a signal occurs. More...
|
|
static
boost::program_options::options_description & | options () |
| Get the registered global program options. More...
|
|
static std::string | helpText () |
|
ApplicationSession is an application with an embedded session. The constructor has to be the first method called of the class to initialize the class. Be careful with the scope of the object, once the destructor is called, the session is destroyed as well.
Definition at line 26 of file applicationsession.hpp.
Constructors of the class.
The session owned by the object can have two different modes: either standard or standalone.
To make an application session standalone, you need to specify the "--qi-standalone" option on the command line arguments or set the option in the configuration passed at the application construction.
A standard session must connect to a service directory, and therefore needs a URL to connect to. This URL is chosen from available values (the ones that have been specified) according to the following order:
- First the URL that was specified as "--qi-url <url>" in the command line arguments.
- Then the URL specified in the "QI_URL" environment variable.
- Finally the URL passed directly or as a member of the configuration to the constructor.
A standalone session cannot connect to a service directory but must instead listen on some URLs. A standard session can also listen, but will only do if the "--qi-listen-url" is given in the command line arguments or if a service is registered on it. In both cases, the URLs to listen on are chosen from available values (the ones that have been specified) according to the following order:
- First the URLs that were specified as "--qi-listen-url <urls>" in the command line arguments.
- Then the URLs specified in the "QI_LISTEN_URL" environment variable.
- Then the URLs in the configuration passed to the constructor.
- Finally the hardcoded default listen URL.
Both the "--qi-listen-url" command line argument and the "QI_LISTEN_URL" environment variable follow the same format "url1;url2;...", allowing the user to specify multiple values.
- Parameters
-
- See Also
- qi::ApplicationSession::Option
- Parameters
-
defaultUrl | The default url used if no –qi-url was found in the command line arguments and no suitable QI_URL environment variable was defined. |