21 #ifndef FAWKES_GOLOGPP_BLACKBOARD_H_
22 #define FAWKES_GOLOGPP_BLACKBOARD_H_
24 #include <blackboard/blackboard.h>
25 #include <blackboard/interface_listener.h>
26 #include <blackboard/interface_observer.h>
27 #include <config/config.h>
28 #include <core/threading/thread.h>
29 #include <golog++/model/action.h>
30 #include <golog++/model/execution.h>
31 #include <logging/logger.h>
55 const std::string &cfg_prefix,
62 void exog_queue_push(gologpp::shared_ptr<gologpp::ExogEvent>);
63 gologpp::shared_ptr<gologpp::ExogAction> find_mapped_exog(
const std::string &mapped_name);
66 class BlackboardEventHandler
70 gologpp::shared_ptr<gologpp::ExogAction> exog,
72 BlackboardEventHandler(
const BlackboardEventHandler &) =
delete;
73 BlackboardEventHandler &operator=(
const BlackboardEventHandler &) =
delete;
74 BlackboardEventHandler(BlackboardEventHandler &&) =
default;
76 gologpp::shared_ptr<gologpp::ExogEvent> make_exog_event(
Interface *)
const;
78 static std::string extract_type_name(
const std::string &iface_uid);
79 static std::string extract_id(
const std::string &iface_uid);
83 gologpp::shared_ptr<gologpp::ExogAction> target_exog_;
84 std::unordered_map<std::string, gologpp::arity_t> fields_order_;
93 const std::string &
id,
94 gologpp::shared_ptr<gologpp::ExogAction>,
96 virtual ~InterfaceWatcher()
override;
98 virtual void bb_interface_data_changed(
Interface *)
throw()
override;
109 const std::string &pattern,
110 gologpp::shared_ptr<gologpp::ExogAction>,
112 virtual ~PatternObserver()
override;
114 virtual void bb_interface_created(
const char *type,
const char *
id)
throw()
override;
117 std::string pattern_;
118 std::mutex handler_mutex_;
122 std::unordered_map<std::string, gologpp::shared_ptr<gologpp::ExogAction>> mapped_exogs_;
123 std::vector<std::unique_ptr<InterfaceWatcher>> watchers_;
124 std::vector<std::unique_ptr<PatternObserver>> observers_;
130 static const std::unordered_map<interface_fieldtype_t, std::string> iface_type_to_golog_type_;
BlackBoard interface listener.
BlackBoard interface observer.
The BlackBoard abstract class.
Interface for configuration handling.
Base class for exceptions in Fawkes.
Base class for all Fawkes BlackBoard interfaces.
Thrown if the config is somehow inconsistent with the agent program.
ConfigError(const std::string &)
Construct a ConfigError.
Watch/observe blackboard interfaces according to the mappings specified for exogenous actions in the ...
const char * name()
Get the ExogManager's thread name.
ExogManager(GologppThread *exec_thread, Configuration *, const std::string &cfg_prefix, BlackBoard *, Logger *)
Constructor.
Main golog++ thread that handles program execution, i.e.
Fawkes library namespace.