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

servicemanager 2.8.7.4

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

- Class List
- Class Hierarchy
- Class Members

All Classes Namespaces Files Functions Variables Enumerations Enumerator Pages
Public Member Functions | Public Attributes | List of all members
qi::ServiceManager Class Reference

ServiceManager Module. More...

`#include <servicemanager.h>`

## Public Member Functions
| ServiceManager (qi::SessionPtr session)
| Launch service manager. More...
| ServiceManager (qi::SessionPtr session, const std::vector< std::string > &coreServices)
| Launch service manager. More...
| ~ServiceManager ()
| Unload service manager. More...
qi::Future< void > | start (const std::string &name)
| Start a service with his `name`. More...
qi::Future< void > | stop (const std::string &name)
| Stop service with his `name`. More...
qi::Future< void > | stopAllServices ()
| Stop all services. More...
qi::Future< void > | restart (const std::string &name)
| Restart a service with his `name`. More...
qi::Future< bool > | isServiceRunning (const std::string &name) const
| Check that the service named `name` is started or not. More...
std::vector < qi::ServiceProcessInfo > | services ()
| Get the list of all services. More...
qi::ServiceProcessInfo | service (const std::string &name)
| Get information about one service named `name`. More...
qi::Future< size_t > | serviceMemoryUsage (const std::string &name)
| Get the memory used by service named `name`. More...
qi::Future< bool > | startService (const std::string &name)
| Start a service with his `name`. More...
qi::Future< bool > | stopService (const std::string &name)
| Stop service with his `name`. More...
qi::Future< bool > | restartService (const std::string &name)
| Restart a service with his `name`. More...

## Public Attributes
qi::Signal< std::string, qi::ServiceEventReason > | serviceStarted
| Sent when a service is started. More...
qi::Signal< std::string, qi::ServiceEventReason > | serviceStopped
| Sent when a service is stopped. More...
qi::Signal< std::string > | serviceAdded
| Signal sent when a new service is handled by ServiceManager. More...
qi::Signal< std::string > | serviceRemoved
| Signal sent when a service is removed from serviceManager. More...

## Detailed Description

ServiceManager Module.

ServiceManager allows you to control services installed by PackageManager.

Each std::string name given by user are processed. The best form is PackageName.ServiceName. The function checking the name throws if package or service does not exist. The other form allowed for compatibility, is ServiceName only. It is dangerous to use that because it may conflict. And you could have launch an other service. It throws if the service cannot be found in any package.

Definition at line 38 of file servicemanager.h.

## Constructor & Destructor Documentation

qi::ServiceManager::ServiceManager | ( | qi::SessionPtr | session | ) |

Launch service manager.

As soon as package manager is available, launch asynchronously autorun-services.

qi::ServiceManager::ServiceManager | ( | qi::SessionPtr | session,
|  | const std::vector< std::string > & | coreServices
| ) |  |

Launch service manager.

As soon as package manager is available, launch asynchronously autorun-services.

qi::ServiceManager::~ServiceManager | ( |  | ) |

Unload service manager.

Stop all services.

## Member Function Documentation

qi::Future<bool> qi::ServiceManager::isServiceRunning | ( | const std::string & | name | ) | const

Check that the service named `name` is started or not.

Returns
  True if service is running, False otherwise.

Exceptions

  std::runtime_error | if name is incorrect. See general description.

qi::Future<void> qi::ServiceManager::restart | ( | const std::string & | name | ) |

Restart a service with his `name`.

In fact, call stop and start.

If service is not already started, it is the same as qi::ServiceManager::startService.

qi::Future<bool> qi::ServiceManager::restartService | ( | const std::string & | name | ) |

Restart a service with his `name`.

In fact, call stop and start.

Deprecated:
  Since 2.5.0 use 'restart' instead

If service is not already started, it is the same as qi::ServiceManager::startService.

qi::ServiceProcessInfo qi::ServiceManager::service | ( | const std::string & | name | ) |

Get information about one service named `name`.

Exceptions

  std::runtime_error | if name is incorrect. See general description.

qi::Future<size_t> qi::ServiceManager::serviceMemoryUsage | ( | const std::string & | name | ) |

Get the memory used by service named `name`.

Exceptions

  std::runtime_error | if name is incorrect. See general description.

std::vector<qi::ServiceProcessInfo> qi::ServiceManager::services | ( |  | ) |

Get the list of all services.

qi::Future<void> qi::ServiceManager::start | ( | const std::string & | name | ) |

Start a service with his `name`.

Send signal qi::ServiceManager::serviceStarted if service is successfully launched.

Returns
  false on error, true on success

qi::Future<bool> qi::ServiceManager::startService | ( | const std::string & | name | ) |

Start a service with his `name`.

Send signal qi::ServiceManager::serviceStarted if service is successfully launched.

Deprecated:
  Since 2.5.0 use 'start' instead
  Returns
    false on error, true on success

qi::Future<void> qi::ServiceManager::stop | ( | const std::string & | name | ) |

Stop service with his `name`.

Try to kill with sigTerm. After 15 second, kill with sigKill.

Send signal qi::ServiceManager::serviceStopped if service is successfully stopped. If service is sigTermed reason of the signal is proccessStopped, if it is sigKilled the reason is processCrashed.

Returns
  false on error, true on success

qi::Future<void> qi::ServiceManager::stopAllServices | ( |  | ) |

Stop all services.

Try to kill with sigTerm. After 15 second, kill with sigKill.

Send signal qi::ServiceManager::serviceStopped if service is successfully stopped. If service is sigTermed reason of the signal is proccessStopped, if it is sigKilled the reason is processCrashed.

Exceptions

  std::runtime_error | If name is incorrect. See general description.

qi::Future<bool> qi::ServiceManager::stopService | ( | const std::string & | name | ) |

Stop service with his `name`.

Try to kill with sigTerm. After 15 second, kill with sigKill.

Send signal qi::ServiceManager::serviceStopped if service is successfully stopped. If service is sigTermed reason of the signal is proccessStopped, if it is sigKilled the reason is processCrashed.

Deprecated:
  Since 2.5.0 use 'stop' instead

Returns
  false on error, true on success

## Member Data Documentation

qi::Signal<std::string> qi::ServiceManager::serviceAdded

Signal sent when a new service is handled by ServiceManager.

Definition at line 188 of file servicemanager.h.

qi::Signal<std::string> qi::ServiceManager::serviceRemoved

Signal sent when a service is removed from serviceManager.

Definition at line 193 of file servicemanager.h.

qi::Signal<std::string, qi::ServiceEventReason> qi::ServiceManager::serviceStarted

Sent when a service is started.

Reason is always ProcessStartRequest.

Definition at line 175 of file servicemanager.h.

qi::Signal<std::string, qi::ServiceEventReason> qi::ServiceManager::serviceStopped

Sent when a service is stopped.

Reason can be ProcessStopRequest when the stop is regular. Or ProcessCrashed if an error occurred.

Definition at line 183 of file servicemanager.h.

The documentation for this class was generated from the following file:

- /home/opennao/work/release-2.8/core/servicemanager/servicemanager.h