#include "Session.h"
Public Member Functions | |
Session () | |
Session (const std::string &_id) | |
Session (const Session &_other) | |
virtual | ~Session () |
Session & | operator= (const Session &_other) |
void | setId (const std::string &_id) |
const std::string & | id (void) const |
void | setUserName (const std::string &_name) |
const std::string & | userName (void) const |
Session (const std::string &_ID, const std::string &_userName, const std::string &_projectName, const std::string &_collectionName, const std::string &_type) | |
Constructor. | |
virtual | ~Session () |
std::string | id (void) const |
Will return the sessions ID. | |
std::string | userName (void) const |
Will return the user name. | |
std::string | projectName (void) const |
Will return the project name. | |
std::string | collectionName (void) const |
WIll return the collection name. | |
std::string | type (void) const |
Will return the type. | |
size_t | serviceCount () const |
Will return the count of the services registered in this session. | |
void | addRequestedService (const std::string &_serviceName, const std::string &_serviceType) |
Will add the provided service information to the requested list This list is used to identify if all the requested services have been registered. | |
void | removeRequestedService (const std::string &_serviceName, const std::string &_serviceType) |
const std::vector< std::pair< std::string, std::string > > & | requestedServices (void) const |
Returns the vector containing all still requested services. | |
void | addDebugPortInUse (ot::port_t _port) |
Adds the proided port number to the debug port list Debug ports will be freed when the session is closing. | |
Service * | registerService (const std::string &_serviceIP, const std::string &_serviceName, const std::string &_serviceType, ot::serviceID_t _serviceID) |
Will store the provided service information and return the ID for the new service. | |
Service * | registerService (Service *_service) |
Will store the provided service as service in this session. | |
void | removeService (ot::serviceID_t _serviceID, bool _notifyOthers=false) |
Will remove the service with the specified ID from this session. | |
Service * | getService (ot::serviceID_t _serviceID) |
Will return the service with the specified ID. | |
Service * | getServiceFromURL (const std::string &_serviceURL) |
Will return the service with the specified URL. | |
std::list< Service * > | getServicesByName (const std::string &_serviceName) |
Will return all services with the given name in this session. | |
std::string | getServiceListJSON (void) |
Will return a JSON string containing all services in this session. | |
std::string | infoToJSON (void) const |
Will return a JSON string representing the main information about this session. | |
void | addServiceListToDocument (ot::JsonDocument &_doc) |
Will add all services to the provided document. | |
void | servicesInformation (ot::JsonArray &servicesInfo, ot::JsonAllocator &allocator) const |
Will return a list of JSON objects containing information about each service. | |
void | broadcastMessage (Service *_sender, const std::string &_message, bool _async=false) |
Will send a broadcast message to all services of this session. | |
void | broadcastAction (Service *_sender, const std::string &_command, bool _async=false) |
Will send a broadcast message to all services of this session. | |
void | broadcast (Service *_sender, const ot::JsonDocument &_message, bool _shutdown, bool _async=false) |
Will broadcast the provided message to all services in this session. | |
void | shutdown (Service *_sender) |
Will shutdown the session. | |
void | serviceFailure (Service *_failedService) |
std::list< std::string > | toolBarTabOrder (void) |
void | setCredentialsUsername (const std::string &username) |
void | setCredentialsPassword (const std::string &password) |
void | setUserCollection (const std::string &collection) |
void | setDatabaseUsername (const std::string &username) |
void | setDatabasePassword (const std::string &password) |
std::string | getCredentialsUsername (void) |
std::string | getCredentialsPassword (void) |
std::string | getUserCollection (void) |
std::string | getType (void) |
std::string | getDatabaseUsername (void) |
std::string | getDatabasePassword (void) |
ot::serviceID_t | generateNextServiceId (void) |
Session::Session | ( | ) |
Session::Session | ( | const std::string & | _id | ) |
Session::Session | ( | const Session & | _other | ) |
|
virtual |
Session::Session | ( | const std::string & | _ID, |
const std::string & | _userName, | ||
const std::string & | _projectName, | ||
const std::string & | _collectionName, | ||
const std::string & | _type ) |
Constructor.
_id | The ID of the session |
_name | The name of the session |
|
virtual |
void Session::addDebugPortInUse | ( | ot::port_t | _port | ) |
Adds the proided port number to the debug port list Debug ports will be freed when the session is closing.
void Session::addRequestedService | ( | const std::string & | _serviceName, |
const std::string & | _serviceType ) |
Will add the provided service information to the requested list This list is used to identify if all the requested services have been registered.
void Session::addServiceListToDocument | ( | ot::JsonDocument & | _doc | ) |
Will add all services to the provided document.
void Session::broadcast | ( | Service * | _sender, |
const ot::JsonDocument & | _message, | ||
bool | _shutdown, | ||
bool | _async = false ) |
Will broadcast the provided message to all services in this session.
_sender | The sender of this message |
_message | The message |
_async | If true the massage(s) will be send from a worker thread |
void Session::broadcastAction | ( | Service * | _sender, |
const std::string & | _command, | ||
bool | _async = false ) |
Will send a broadcast message to all services of this session.
_sender | The sender of this message |
_command | The command to send |
_async | If true the massage(s) will be send from a worker thread |
void Session::broadcastMessage | ( | Service * | _sender, |
const std::string & | _message, | ||
bool | _async = false ) |
Will send a broadcast message to all services of this session.
_sender | The sender of this message |
_message | The message text |
_async | If true the massage(s) will be send from a worker thread |
|
inline |
WIll return the collection name.
ot::serviceID_t Session::generateNextServiceId | ( | void | ) |
|
inline |
|
inline |
|
inline |
|
inline |
Service * Session::getService | ( | ot::serviceID_t | _serviceID | ) |
Will return the service with the specified ID.
_serviceIP | The ID of the service |
Service * Session::getServiceFromURL | ( | const std::string & | _serviceURL | ) |
Will return the service with the specified URL.
_serviceURL | The URL of the service |
std::string Session::getServiceListJSON | ( | void | ) |
Will return a JSON string containing all services in this session.
std::list< Service * > Session::getServicesByName | ( | const std::string & | _serviceName | ) |
Will return all services with the given name in this session.
|
inline |
|
inline |
|
inline |
|
inline |
Will return the sessions ID.
std::string Session::infoToJSON | ( | void | ) | const |
Will return a JSON string representing the main information about this session.
|
inline |
Will return the project name.
Service * Session::registerService | ( | const std::string & | _serviceIP, |
const std::string & | _serviceName, | ||
const std::string & | _serviceType, | ||
ot::serviceID_t | _serviceID ) |
Will store the provided service information and return the ID for the new service.
_serviceIP | The IP of the new service |
_serviceName | The name of the service |
_serviceType | The type of the service |
Will store the provided service as service in this session.
_service | The service to store |
void Session::removeRequestedService | ( | const std::string & | _serviceName, |
const std::string & | _serviceType ) |
void Session::removeService | ( | ot::serviceID_t | _serviceID, |
bool | _notifyOthers = false ) |
Will remove the service with the specified ID from this session.
_serviceID | The ID of the service to remove |
_notifyOthers | If true, a broadcast message will be send that the service is shutting down |
|
inline |
Returns the vector containing all still requested services.
|
inline |
Will return the count of the services registered in this session.
void Session::serviceFailure | ( | Service * | _failedService | ) |
void Session::servicesInformation | ( | ot::JsonArray & | servicesInfo, |
ot::JsonAllocator & | allocator ) const |
Will return a list of JSON objects containing information about each service.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
void Session::shutdown | ( | Service * | _sender | ) |
Will shutdown the session.
std::list< std::string > Session::toolBarTabOrder | ( | void | ) |
|
inline |
Will return the type.
|
inline |
|
inline |
Will return the user name.