|
Fawkes API
Fawkes Development Version
|
This class manages registering computables and can check if any computables are invoced by a query. More...
#include <computables_manager.h>
Public Member Functions | |
| ComputablesManager (fawkes::Configuration *config, RobotMemory *robot_memory) | |
| Constructor for class managing computables with refereces to plugin objects. More... | |
| bool | check_and_compute (const bsoncxx::document::view &query, std::string collection) |
| Checks if computable knowledge is queried and calls the compute functions in this case. More... | |
| void | remove_computable (Computable *computable) |
| Remove previously registered computable. More... | |
| void | cleanup_computed_docs () |
| Clean up all collections containing documents computed on demand. More... | |
| template<typename T > | |
| Computable * | register_computable (bsoncxx::document::value &&query_to_compute, const std::string &collection, std::list< bsoncxx::document::value >(T::*compute_func)(const bsoncxx::document::view &, const std::string &), T *obj, double caching_time=0.0, int priority=0) |
| Registers a Computable which provides information in the robot memory that is computed on demand. More... | |
This class manages registering computables and can check if any computables are invoced by a query.
Definition at line 48 of file computables_manager.h.
| ComputablesManager::ComputablesManager | ( | fawkes::Configuration * | config, |
| RobotMemory * | robot_memory | ||
| ) |
Constructor for class managing computables with refereces to plugin objects.
| config | Configuration |
| robot_memory | Robot Memory |
Definition at line 49 of file computables_manager.cpp.
References fawkes::Configuration::get_string().
| bool ComputablesManager::check_and_compute | ( | const bsoncxx::document::view & | query, |
| std::string | collection | ||
| ) |
Checks if computable knowledge is queried and calls the compute functions in this case.
| query | The query that might ask for computable knowledge |
| collection | The collection that is querried |
Definition at line 114 of file computables_manager.cpp.
References RobotMemory::drop_collection(), RobotMemory::insert(), and RobotMemory::query().
| void ComputablesManager::cleanup_computed_docs | ( | ) |
Clean up all collections containing documents computed on demand.
Definition at line 165 of file computables_manager.cpp.
|
inline |
Registers a Computable which provides information in the robot memory that is computed on demand.
| query_to_compute | Query describing what the function computes. Yor computable is called when an new query matches query_to_compute. |
| collection | db.collection to fill with computed information |
| compute_func | Callback function that computes the information and retruns a list of computed documents |
| obj | Pointer to class the callback is a function of (usaually this) |
| caching_time | How long should computed results for a query be cached and be used for identical queries in that time? |
| priority | Computable priority ordering the evaluation |
Definition at line 70 of file computables_manager.h.
Referenced by RobotMemory::register_computable().
| void ComputablesManager::remove_computable | ( | Computable * | computable | ) |
Remove previously registered computable.
| computable | The computable to remove |
Definition at line 95 of file computables_manager.cpp.