ReCodEx - Task Broker
ReCodEx is complex programmer testing solution, primary targeted to technical universities. It's highly customizable and based on modern technologies.
command_holder.h
1 #ifndef RECODEX_BROKER_COMMANDS_BASE_H
2 #define RECODEX_BROKER_COMMANDS_BASE_H
3 
4 #include "../helpers/logger.h"
5 #include "../notifier/empty_status_notifier.h"
6 #include "../notifier/status_notifier.h"
7 #include "../worker_registry.h"
8 #include "handler_interface.h"
9 #include "message_container.h"
10 #include <functional>
11 #include <map>
12 #include <memory>
13 #include <string>
14 
15 
23 {
24 public:
26  typedef std::function<void(const std::string &, const std::vector<std::string> &, handler_interface::response_cb)>
28 
36  void call_function(const std::string &command,
37  const std::string &identity,
38  const std::vector<std::string> &message,
40 
47  bool register_command(const std::string &command, callback_fn callback);
48 
49 private:
51  std::map<std::string, callback_fn> functions_;
52 };
53 
54 #endif // RECODEX_BROKER_COMMANDS_BASE_H
std::function< void(const message_container &)> response_cb
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)
std::function< void(const std::string &, const std::vector< std::string > &, handler_interface::response_cb)> callback_fn