|
ReCodEx - Task Broker
ReCodEx is complex programmer testing solution, primary targeted to technical universities. It's highly customizable and based on modern technologies.
|
#include <command_holder.h>
Public Types | |
| typedef std::function< void(const std::string &, const std::vector< std::string > &, handler_interface::response_cb)> | callback_fn |
Public Member Functions | |
| void | call_function (const std::string &command, const std::string &identity, const std::vector< std::string > &message, handler_interface::response_cb respond) |
| bool | register_command (const std::string &command, callback_fn callback) |
Command holder.
This class can handle, register and execute commands with corresponding callbacks. Command is std::string, callback is a function with signature corresponding to command_holder::callback_fn
Definition at line 22 of file command_holder.h.
| typedef std::function<void(const std::string &, const std::vector<std::string> &, handler_interface::response_cb)> command_holder::callback_fn |
Type of callback function for easier use.
Definition at line 27 of file command_holder.h.
| void command_holder::call_function | ( | const std::string & | command, |
| const std::string & | identity, | ||
| const std::vector< std::string > & | message, | ||
| handler_interface::response_cb | respond | ||
| ) |
Invoke registered callback for given command (if any).
| command | String reprezentation of command for processing. |
| identity | Unique ID of each worker for connection subsystem. |
| message | Arguments for callback function. |
| respond | a callback to let the handler respond |
Definition at line 3 of file command_holder.cpp.
| bool command_holder::register_command | ( | const std::string & | command, |
| command_holder::callback_fn | callback | ||
| ) |
Register new command with a callback.
| command | String reprezentation of command. |
| callback | Function to call when this command occurs. |
Definition at line 14 of file command_holder.cpp.