A class to handle the state client requests at the EM side.
More...
#include <state_server.h>
|
| StateServer (com::someip::rpc::RpcServer *rpcServer, std::set< std::pair< std::string, std::string > > &&functionGroupStates, std::map< std::string, std::string > &&initialStates) |
| Constructor. More...
|
|
bool | TryGetState (std::string functionGroup, std::string &state) |
| Try to get the state of a function group. More...
|
|
void | SetNotifier (std::string functionGroup, std::function< void()> callback) |
| Set a notifier at the state changed of a function group. More...
|
|
bool | Initialized () const noexcept |
| Indicate whether or not EM has been initialized. More...
|
|
A class to handle the state client requests at the EM side.
- See also
- StateClient
- Note
- The class is not part of the ARA standard.
◆ StateServer()
ara::exec::StateServer::StateServer |
( |
com::someip::rpc::RpcServer * |
rpcServer, |
|
|
std::set< std::pair< std::string, std::string > > && |
functionGroupStates, |
|
|
std::map< std::string, std::string > && |
initialStates |
|
) |
| |
Constructor.
- Parameters
-
rpcServer | RPC server abstraction layer |
functionGroupStates | Function groups and their possible states combination |
initialStates | Initial states of the function groups |
- Exceptions
-
std::invalid_argument | Throws when an initial state refers to an invalid function group |
std::logic_error | Throws when a function group lacks of the initial state |
◆ Initialized()
bool ara::exec::StateServer::Initialized |
( |
| ) |
const |
|
noexcept |
Indicate whether or not EM has been initialized.
- Returns
- True if EM is initialized; otherwise false
◆ SetNotifier()
void ara::exec::StateServer::SetNotifier |
( |
std::string |
functionGroup, |
|
|
std::function< void()> |
callback |
|
) |
| |
Set a notifier at the state changed of a function group.
- Parameters
-
functionGroup | Function group of interest |
callback | Callback to be invoked at the state change |
- Exceptions
-
std::out_of_range | Throws when the function group does not exist |
◆ TryGetState()
bool ara::exec::StateServer::TryGetState |
( |
std::string |
functionGroup, |
|
|
std::string & |
state |
|
) |
| |
Try to get the state of a function group.
- Parameters
-
[in] | functionGroup | Function group name |
[out] | state | Function group state |
- Returns
- True if the function group exits; otherwise false