MADARA
3.1.8
|
This class provides a distributed knowledge base to users. More...
#include <KnowledgeBase.h>
Public Member Functions | |
KnowledgeBase () | |
Constructor. More... | |
KnowledgeBase (const std::string &host, int transport) | |
Constructor. More... | |
KnowledgeBase (const std::string &host, int transport, const std::string &domain) | |
Constructor. More... | |
KnowledgeBase (const std::string &host, const madara::transport::TransportSettings &config) | |
Constructor. More... | |
KnowledgeBase (const KnowledgeBase &original)=default | |
Copy constructor. More... | |
~KnowledgeBase ()=default | |
Destructor. More... | |
void | acquire (void) |
Acquires the recursive lock on the knowledge base. More... | |
void | activate_transport (void) |
Starts the transport mechanism for dissemination if it is closed. More... | |
void | add_modifieds (const VariableReferences &modifieds) const |
Adds a list of VariableReferences to the current modified list. More... | |
int | apply_modified (const EvalSettings &settings=EvalSettings()) |
Applies current time and modified to all global variables and tries to send them. More... | |
void | attach_logger (logger::Logger &logger) const |
Attaches a logger to be used for printing. More... | |
size_t | attach_transport (madara::transport::Base *transport) |
Attaches a transport to the Knowledge Engine. More... | |
size_t | attach_transport (const std::string &id, transport::TransportSettings &settings) |
Adds a built-in transport with the specified settings. More... | |
bool | clear (const std::string &key, const KnowledgeReferenceSettings &settings=KnowledgeReferenceSettings()) |
Clears a variable. More... | |
void | clear (bool erase=false) |
Clears the knowledge base. More... | |
void | clear_map (void) |
Clears the knowledge base. More... | |
void | clear_modifieds (void) |
Clear all modifications to the knowledge base. More... | |
void | close_transport (void) |
Closes the transport mechanism so no dissemination is possible. More... | |
CompiledExpression | compile (const std::string &expression) |
Compiles a KaRL expression into an expression tree. More... | |
void | copy (const KnowledgeBase &source, const KnowledgeRequirements &settings) |
Copies variables and values from source to this context. More... | |
void | copy (const KnowledgeBase &source, const CopySet ©_set=CopySet(), bool clean_copy=false) |
Copies variables and values from source to this context. More... | |
std::string | debug_modifieds (void) const |
Retrieves a stringified list of all modified variables that are ready to send over transport on next send_modifieds call. More... | |
void | define_function (const std::string &name, knowledge::KnowledgeRecord(*func)(FunctionArguments &, Variables &)) |
Defines a function. More... | |
void | define_function (const std::string &name, knowledge::KnowledgeRecord(*func)(const char *, FunctionArguments &, Variables &)) |
Defines a named function that can distinguish the name it was called with in MADARA. More... | |
void | define_function (const std::string &name, const std::string &expression) |
Defines a MADARA KaRL function. More... | |
void | define_function (const std::string &name, const CompiledExpression &expression) |
Defines a MADARA KaRL function. More... | |
madara::knowledge::KnowledgeRecord | evaluate (const std::string &expression, const EvalSettings &settings=EvalSettings()) |
Evaluates an expression. More... | |
madara::knowledge::KnowledgeRecord | evaluate (CompiledExpression &expression, const EvalSettings &settings=EvalSettings()) |
Evaluates an expression. More... | |
madara::knowledge::KnowledgeRecord | evaluate (expression::ComponentNode *root, const EvalSettings &settings=EvalSettings()) |
Evaluates a root-based tree (result of compile) More... | |
bool | exists (const std::string &key, const KnowledgeReferenceSettings &settings=KnowledgeReferenceSettings(false)) const |
Checks if a knowledge location exists in the context. More... | |
bool | exists (const VariableReference &variable, const KnowledgeReferenceSettings &settings=KnowledgeReferenceSettings(false)) const |
Checks if a knowledge variable exists in the context. More... | |
std::string | expand_statement (const std::string &statement) |
Expands a statement using variable expansion. More... | |
void | facade_for (ThreadSafeContext &target) |
Change the knowledge base to become a facade for another context. More... | |
madara::knowledge::KnowledgeRecord | get (const std::string &key, const KnowledgeReferenceSettings &settings=KnowledgeReferenceSettings(false)) |
Retrieves a knowledge value. More... | |
madara::knowledge::KnowledgeRecord | get (const VariableReference &variable, const KnowledgeReferenceSettings &settings=KnowledgeReferenceSettings(false)) |
Atomically returns the value of a variable. More... | |
ThreadSafeContext & | get_context (void) |
Returns the ThreadSafeContext associated with this Knowledge Base. More... | |
std::string | get_id (void) |
Returns the unique host and ephemeral binding for this Knowlede Base. More... | |
int | get_log_level (void) |
Gets the log level. More... | |
logger::Logger & | get_logger (void) const |
Gets the logger used for information printing. More... | |
void | get_matches (const std::string &prefix, const std::string &suffix, VariableReferences &matches) |
Creates an iteration of VariableReferences to all keys matching the prefix and suffix. More... | |
size_t | get_num_transports (void) |
Gets the number of transports. More... | |
VariableReference | get_ref (const std::string &key, const KnowledgeReferenceSettings &settings=KnowledgeReferenceSettings(false)) |
Atomically returns a reference to the variable. More... | |
int64_t | load_context (const std::string &filename, bool use_id=true, const KnowledgeUpdateSettings &settings=KnowledgeUpdateSettings(true, true, true, false)) |
Loads the context from a file. More... | |
int64_t | load_context (const std::string &filename, FileHeader &meta, bool use_id=true, const KnowledgeUpdateSettings &settings=KnowledgeUpdateSettings(true, true, true, false)) |
Loads the context from a file. More... | |
int64_t | load_context (CheckpointSettings &checkpoint_settings, const KnowledgeUpdateSettings &update_settings=KnowledgeUpdateSettings(true, true, true, false)) |
Loads the context from a file. More... | |
void | lock (void) |
Locks the context to prevent updates over the network. More... | |
void | mark_modified (const VariableReference &variable, const KnowledgeUpdateSettings &settings=KnowledgeUpdateSettings()) |
Marks the variable reference as updated. More... | |
void | mark_modified (const std::string &name, const KnowledgeUpdateSettings &settings=KnowledgeUpdateSettings()) |
Marks the variable as updated. More... | |
int | modify (const EvalSettings &settings=EvalSettings()) |
Alias for apply_modified. More... | |
KnowledgeBase & | operator= (const KnowledgeBase &original)=default |
Assigns another instance's knowledge and settings to this instance. More... | |
void | print (unsigned int level=0) const |
Prints all knowledge variables and values in the context. More... | |
void | print (const std::string &statement, unsigned int level=0) const |
Expands and prints a user provided statement at a logging level. More... | |
void | print_knowledge (unsigned int level=0) const |
Deprecated alias for. More... | |
int | read_file (const std::string &knowledge_key, const std::string &filename, const EvalSettings &settings=EvalSettings(false, false, true, false, false)) |
Read a file into the knowledge base. More... | |
int | read_file (const VariableReference &variable, const std::string &filename, const EvalSettings &settings=EvalSettings(false, false, true, false, false)) |
Atomically reads a file into a variable. More... | |
int | read_policy (const std::string &policy_key, const std::string &policy_file) |
Read a policy into the knowledge base. More... | |
void | release (void) |
Releases a recursive lock on the knowledge base. More... | |
size_t | remove_transport (size_t index) |
Removes a transport. More... | |
void | reset_checkpoint (void) const |
Resets the local changed map, which tracks checkpointing modifieds. More... | |
madara::knowledge::KnowledgeRecord | retrieve_index (const std::string &key, size_t index, const KnowledgeReferenceSettings &settings=KnowledgeReferenceSettings(false)) |
Retrieves a value at a specified index within a knowledge array. More... | |
madara::knowledge::KnowledgeRecord | retrieve_index (const VariableReference &variable, size_t index, const KnowledgeReferenceSettings &settings=EvalSettings(false, false, true, false, false)) |
Retrieves a value at a specified index within a knowledge array. More... | |
int64_t | save_as_json (const std::string &filename) const |
Saves the context to a file as JSON. More... | |
int64_t | save_as_json (const CheckpointSettings &settings) const |
Saves the context to a file as JSON. More... | |
int64_t | save_as_karl (const std::string &filename) const |
Saves the context to a file as karl assignments, rather than binary. More... | |
int64_t | save_as_karl (const CheckpointSettings &settings) const |
Saves the context to a file as karl assignments, rather than binary. More... | |
int64_t | save_checkpoint (const std::string &filename, bool reset_modifieds=true) |
Saves a checkpoint of a list of changes to a file. More... | |
int64_t | save_checkpoint (CheckpointSettings &settings) const |
Saves a checkpoint of a list of changes to a file. More... | |
int64_t | save_context (const std::string &filename) const |
Saves the context to a file. More... | |
int64_t | save_context (CheckpointSettings &settings) const |
Saves the context to a file. More... | |
VariableReferences | save_modifieds (void) const |
Saves the list of modified records to use later for resending. More... | |
int | send_modifieds (const std::string &prefix="KnowledgeBase::send_modifieds", const EvalSettings &settings=EvalSettings()) |
Sends all modified variables through the attached transports. More... | |
int | set (const VariableReference &variable, const std::string &value, const EvalSettings &settings=EvalSettings(false, false, true, false, false)) |
Atomically sets the value of a variable to a string. More... | |
int | set (const VariableReference &variable, std::string &&value, const EvalSettings &settings=EvalSettings(false, false, true, false, false)) |
Atomically sets the value of a variable to a string. More... | |
int | set (const VariableReference &variable, const KnowledgeRecord &value, const EvalSettings &settings=EvalSettings(false, false, true, false, false)) |
Atomically sets the value of a variable to a KnowledgeRecord. More... | |
int | set (const VariableReference &variable, KnowledgeRecord &&value, const EvalSettings &settings=EvalSettings(false, false, true, false, false)) |
Atomically sets the value of a variable to a KnowledgeRecord. More... | |
int | set (const std::string &key, const KnowledgeRecord &value, const EvalSettings &settings=EvalSettings(false, false, true, false, false)) |
Atomically sets the value of a variable to a KnowledgeRecord. More... | |
int | set (const std::string &key, KnowledgeRecord &&value, const EvalSettings &settings=EvalSettings(false, false, true, false, false)) |
Atomically sets the value of a variable to a KnowledgeRecord. More... | |
int | set (const VariableReference &variable, const EvalSettings &settings=EvalSettings(false, false, true, false, false)) |
Atomically sets the value of a variable to an integer 1. More... | |
int | set (const VariableReference &variable, const std::vector< double > &value, const EvalSettings &settings=EvalSettings(false, false, true, false, false)) |
Atomically sets the value of a variable to a double array. More... | |
int | set (const VariableReference &variable, std::vector< double > &&value, const EvalSettings &settings=EvalSettings(false, false, true, false, false)) |
Atomically sets the value of a variable to a double array. More... | |
int | set (const VariableReference &variable, const double *value, uint32_t size, const EvalSettings &settings=EvalSettings(false, false, true, false, false)) |
Atomically sets the value of a variable to a double array. More... | |
template<typename T , typename std::enable_if< std::is_floating_point< T >::value, void * >::type = nullptr> | |
int | set (const VariableReference &variable, T value, const EvalSettings &settings=EvalSettings(false, false, true, false, false)) |
Atomically sets the value of a variable to a double. More... | |
int | set (const VariableReference &variable, const std::vector< KnowledgeRecord::Integer > &value, const EvalSettings &settings=EvalSettings(false, false, true, false, false)) |
Atomically sets the value of a variable to an integer array. More... | |
int | set (const VariableReference &variable, std::vector< KnowledgeRecord::Integer > &&value, const EvalSettings &settings=EvalSettings(false, false, true, false, false)) |
Atomically sets the value of a variable to an integer array. More... | |
int | set (const VariableReference &variable, const madara::knowledge::KnowledgeRecord::Integer *value, uint32_t size, const EvalSettings &settings=EvalSettings(false, false, true, false, false)) |
Atomically sets the value of a variable to an integer array. More... | |
template<typename T , typename std::enable_if< std::is_integral< T >::value, void * >::type = nullptr> | |
int | set (const VariableReference &variable, T value, const EvalSettings &settings=EvalSettings(false, false, true, false, false)) |
Atomically sets the value of a variable to an integer. More... | |
template<typename T , typename std::enable_if< std::is_integral< T >::value, void * >::type = nullptr> | |
int | set (const std::string &key, T value, const EvalSettings &settings=EvalSettings(false, false, true, false, false)) |
Sets a knowledge variable to a specified value. More... | |
int | set (const std::string &key, const madara::knowledge::KnowledgeRecord::Integer *value, uint32_t size, const EvalSettings &settings=EvalSettings(false, false, true, false, false)) |
Sets a knowledge variable to a specified value. More... | |
int | set (const std::string &key, const std::vector< KnowledgeRecord::Integer > &value, const EvalSettings &settings=EvalSettings(false, false, true, false, false)) |
Sets a knowledge variable to a specified value. More... | |
int | set (const std::string &key, std::vector< KnowledgeRecord::Integer > &&value, const EvalSettings &settings=EvalSettings(false, false, true, false, false)) |
Sets a knowledge variable to a specified value. More... | |
int | set (const std::string &key, const EvalSettings &settings=EvalSettings(false, false, true, false, false)) |
Atomically sets the value of a variable to an integer 1. More... | |
template<typename T , typename std::enable_if< std::is_floating_point< T >::value, void * >::type = nullptr> | |
int | set (const std::string &key, T value, const EvalSettings &settings=EvalSettings(false, false, true, false, false)) |
Sets a knowledge variable to a specified value. More... | |
int | set (const std::string &key, const double *value, uint32_t size, const EvalSettings &settings=EvalSettings(false, false, true, false, false)) |
Sets a knowledge variable to a specified value. More... | |
int | set (const std::string &key, const std::vector< double > &value, const EvalSettings &settings=EvalSettings(false, false, true, false, false)) |
Sets a knowledge variable to a specified value. More... | |
int | set (const std::string &key, std::vector< double > &&value, const EvalSettings &settings=EvalSettings(false, false, true, false, false)) |
Sets a knowledge variable to a specified value. More... | |
int | set (const std::string &key, const std::string &value, const EvalSettings &settings=EvalSettings(false, false, true, false, false)) |
Sets a knowledge variable to a specified value. More... | |
int | set (const std::string &key, std::string &&value, const EvalSettings &settings=EvalSettings(false, false, true, false, false)) |
Sets a knowledge variable to a specified value. More... | |
int | set_file (const std::string &key, const unsigned char *value, size_t size, const EvalSettings &settings=EvalSettings(false, false, true, false, false)) |
Atomically sets the value of a variable to an arbitrary string. More... | |
int | set_file (const VariableReference &variable, const unsigned char *value, size_t size, const EvalSettings &settings=EvalSettings(false, false, true, false, false)) |
Atomically sets the value of a variable to an arbitrary string. More... | |
template<typename T > | |
int | set_index (const VariableReference &variable, size_t index, T &&value, const EvalSettings &settings=EvalSettings(false, false, true, false, false)) |
Atomically sets the value of an array index to a value. More... | |
template<typename T > | |
int | set_index (const std::string &key, size_t index, T &&value, const EvalSettings &settings=EvalSettings(false, false, true, false, false)) |
Sets an index within an array to a specified value. More... | |
int | set_jpeg (const std::string &key, const unsigned char *value, size_t size, const EvalSettings &settings=EvalSettings(false, false, true, false, false)) |
Atomically sets the value of a variable to a JPEG image. More... | |
int | set_jpeg (const VariableReference &variable, const unsigned char *value, size_t size, const EvalSettings &settings=EvalSettings(false, false, true, false, false)) |
Atomically sets the value of a variable to a JPEG image. More... | |
void | set_log_level (int level) |
Sets the log level. More... | |
void | set_quality (const std::string &key, uint32_t quality, const KnowledgeReferenceSettings &settings=KnowledgeReferenceSettings(false)) |
Sets the quality of writing to a certain variable from this entity. More... | |
int | set_text (const VariableReference &variable, const char *value, size_t size, const EvalSettings &settings=EvalSettings(false, false, true, false, false)) |
Atomically sets the value of a variable to a text file's contents. More... | |
int | set_xml (const VariableReference &variable, const char *value, size_t size, const EvalSettings &settings=EvalSettings(false, false, true, false, false)) |
Atomically sets the value of a variable to an XML string. More... | |
std::string | setup_unique_hostport (const std::string &host="") |
Binds to an ephemeral port for unique tie breakers in global ordering. More... | |
std::shared_ptr< std::vector< unsigned char > > | share_binary (const std::string &key, const KnowledgeReferenceSettings &settings=KnowledgeReferenceSettings()) const |
Returns a shared_ptr, sharing with the internal one. More... | |
std::shared_ptr< std::vector< unsigned char > > | share_binary (const VariableReference &key, const KnowledgeReferenceSettings &settings=KnowledgeReferenceSettings()) const |
Returns a shared_ptr, sharing with the internal one. More... | |
std::shared_ptr< std::vector< double > > | share_doubles (const std::string &key, const KnowledgeReferenceSettings &settings=KnowledgeReferenceSettings()) const |
Returns a shared_ptr, sharing with the internal one. More... | |
std::shared_ptr< std::vector< double > > | share_doubles (const VariableReference &key, const KnowledgeReferenceSettings &settings=KnowledgeReferenceSettings()) const |
Returns a shared_ptr, sharing with the internal one. More... | |
std::shared_ptr< std::vector< KnowledgeRecord::Integer > > | share_integers (const std::string &key, const KnowledgeReferenceSettings &settings=KnowledgeReferenceSettings()) const |
Returns a shared_ptr, sharing with the internal one. More... | |
std::shared_ptr< std::vector< KnowledgeRecord::Integer > > | share_integers (const VariableReference &key, const KnowledgeReferenceSettings &settings=KnowledgeReferenceSettings()) const |
Returns a shared_ptr, sharing with the internal one. More... | |
std::shared_ptr< std::string > | share_string (const std::string &key, const KnowledgeReferenceSettings &settings=KnowledgeReferenceSettings()) const |
Returns a shared_ptr, sharing with the internal one. More... | |
std::shared_ptr< std::string > | share_string (const VariableReference &key, const KnowledgeReferenceSettings &settings=KnowledgeReferenceSettings()) const |
Returns a shared_ptr, sharing with the internal one. More... | |
std::shared_ptr< std::vector< unsigned char > > | take_binary (const std::string &key, const KnowledgeReferenceSettings &settings=KnowledgeReferenceSettings()) |
Returns a shared_ptr, sharing with the internal one. More... | |
std::shared_ptr< std::vector< unsigned char > > | take_binary (const VariableReference &key, const KnowledgeReferenceSettings &settings=KnowledgeReferenceSettings()) |
Returns a shared_ptr, sharing with the internal one. More... | |
std::shared_ptr< std::vector< double > > | take_doubles (const std::string &key, const KnowledgeReferenceSettings &settings=KnowledgeReferenceSettings()) |
Returns a shared_ptr, sharing with the internal one. More... | |
std::shared_ptr< std::vector< double > > | take_doubles (const VariableReference &key, const KnowledgeReferenceSettings &settings=KnowledgeReferenceSettings()) |
Returns a shared_ptr, sharing with the internal one. More... | |
std::shared_ptr< std::vector< KnowledgeRecord::Integer > > | take_integers (const std::string &key, const KnowledgeReferenceSettings &settings=KnowledgeReferenceSettings()) |
Returns a shared_ptr, sharing with the internal one. More... | |
std::shared_ptr< std::vector< KnowledgeRecord::Integer > > | take_integers (const VariableReference &key, const KnowledgeReferenceSettings &settings=KnowledgeReferenceSettings()) |
Returns a shared_ptr, sharing with the internal one. More... | |
std::shared_ptr< std::string > | take_string (const std::string &key, const KnowledgeReferenceSettings &settings=KnowledgeReferenceSettings()) |
Returns a shared_ptr, while resetting this record to empty. More... | |
std::shared_ptr< std::string > | take_string (const VariableReference &key, const KnowledgeReferenceSettings &settings=KnowledgeReferenceSettings()) |
Returns a shared_ptr, while resetting this record to empty. More... | |
size_t | to_map (const std::string &subject, std::map< std::string, knowledge::KnowledgeRecord > &target) |
Fills a variable map with Knowledge Records that match an expression. More... | |
size_t | to_map (const std::string &prefix, const std::string &delimiter, const std::string &suffix, std::vector< std::string > &next_keys, std::map< std::string, knowledge::KnowledgeRecord > &result, bool just_keys=false) |
Fills a variable map with list of keys according to a matching prefix, suffix, and delimiter hierarchy. More... | |
knowledge::KnowledgeMap | to_map (const std::string &prefix) const |
Creates a variable map with Knowledge Records that begin with the given prefix. More... | |
knowledge::KnowledgeMap | to_map_stripped (const std::string &prefix) const |
Creates a map with Knowledge Records that begin with the given prefix. More... | |
void | to_string (std::string &target, const std::string &array_delimiter=",", const std::string &record_delimiter=";\n", const std::string &key_val_delimiter="=") const |
Saves all keys and values into a string, using the underlying knowledge::KnowledgeRecord::to_string function. More... | |
size_t | to_vector (const std::string &subject, unsigned int start, unsigned int end, std::vector< KnowledgeRecord > &target) |
Fills a vector with Knowledge Records that begin with a common subject and have a finite range of integer values. More... | |
madara::transport::TransportSettings & | transport_settings (void) |
Returns a non-const reference to the Transport Settings. More... | |
void | unlock (void) |
Unlocks the context to allow updates over the network (is only necessary if the context has been explicitly locked) More... | |
void | use (ThreadSafeContext &original) |
Refer to and use another knowledge base's context. More... | |
madara::knowledge::KnowledgeRecord | wait (const std::string &expression, const WaitSettings &settings=WaitSettings()) |
Waits for an expression to be non-zero. More... | |
madara::knowledge::KnowledgeRecord | wait (CompiledExpression &expression, const WaitSettings &settings=WaitSettings()) |
Waits for an expression to be non-zero. More... | |
void | wait_for_change (void) |
Wait for a change to happen to the context (e.g., from transports) More... | |
ssize_t | write_file (const std::string &knowledge_key, const std::string &filename) |
Write a file from the knowledge base to a specified location. More... | |
Private Attributes | |
ThreadSafeContext * | context_ |
A knowledge base can also be a facade for another knowledge base. More... | |
std::shared_ptr< KnowledgeBaseImpl > | impl_ |
Pointer to actual implementation, i.e., the "bridge", which is reference counted to automate memory management. More... | |
This class provides a distributed knowledge base to users.
Definition at line 44 of file KnowledgeBase.h.
|
inline |
Constructor.
Definition at line 17 of file KnowledgeBase.inl.
|
inline |
Constructor.
host | hostname/ip of this machine |
transport | transport to use for knowledge dissemination |
Definition at line 22 of file KnowledgeBase.inl.
|
inline |
Constructor.
host | hostname/ip of this machine |
transport | transport to use for knowledge dissemination |
domain | knowledge domain we want to join |
Definition at line 28 of file KnowledgeBase.inl.
|
inline |
Constructor.
host | hostname/ip of this machine |
config | transport settings to use for dissemination |
Definition at line 36 of file KnowledgeBase.inl.
|
default |
Copy constructor.
original | knowledge base to copy |
|
default |
Destructor.
|
inline |
Acquires the recursive lock on the knowledge base.
This will block any other thread from updating or using the knowledge base until you call @ release.
Definition at line 1258 of file KnowledgeBase.inl.
|
inline |
Starts the transport mechanism for dissemination if it is closed.
Definition at line 1489 of file KnowledgeBase.inl.
|
inline |
Adds a list of VariableReferences to the current modified list.
modifieds | a list of variables to add to modified list |
Definition at line 1583 of file KnowledgeBase.inl.
|
inline |
Applies current time and modified to all global variables and tries to send them.
settings | Settings for evaluating and printing |
Definition at line 268 of file KnowledgeBase.inl.
|
inline |
Attaches a logger to be used for printing.
logger | the logger the context should lose |
Definition at line 199 of file KnowledgeBase.inl.
|
inline |
Attaches a transport to the Knowledge Engine.
Note that the transport should use the same ThreadSafeContext as the Knowledge Engine.
transport | a new transport to attach to the Knowledge Base |
Definition at line 1498 of file KnowledgeBase.inl.
|
inline |
Adds a built-in transport with the specified settings.
id | unique identifier for this agent (empty string will use default generated id) |
settings | settings for the new transport |
Definition at line 1525 of file KnowledgeBase.inl.
|
inline |
Clears a variable.
This is safer than erasing the variable. It clears the memory used in the variable and marks it as UNCREATED, meaning that it is effectively deleted, will not show up in
key | unique identifier of the variable |
settings | settings for referring to variables |
Definition at line 1214 of file KnowledgeBase.inl.
|
inline |
Clears the knowledge base.
erase | If true, completely erase keys. If false, reset knowledge |
Definition at line 1232 of file KnowledgeBase.inl.
|
inline |
Clears the knowledge base.
Definition at line 1245 of file KnowledgeBase.inl.
|
inline |
Clear all modifications to the knowledge base.
This action may be useful if you are wanting to keep local changes but not inform other agents (possibly due to a need to further process and verify the information). The knowledge stays in its current form (i.e., this does not roll back state or anything like that)
Definition at line 1570 of file KnowledgeBase.inl.
|
inline |
Closes the transport mechanism so no dissemination is possible.
Definition at line 286 of file KnowledgeBase.inl.
|
inline |
Compiles a KaRL expression into an expression tree.
expression | expression to compile |
Definition at line 1286 of file KnowledgeBase.inl.
|
inline |
Copies variables and values from source to this context.
PERFORMANCE NOTES: predicates with prefixes can limit copying to O(log n). predices with suffixes and no prefix force O(n) copy cost since all records could fit requirements
source | the source context to copy from |
settings | requirements that must be met |
Definition at line 227 of file KnowledgeBase.inl.
|
inline |
Copies variables and values from source to this context.
PERFORMANCE NOTES: worst case depends on size of copy_set. If empty, performance is always O (n), where n is number of variables in the source context. If copy_set is not empty, then performance is O (m log n) where m is the number of variables in copy_set and n is number of variables in the source context.
Note that this is a deep copy due to the fact that source and destination are expected to have their own thread management (ref-counted variables can be problematic if shallow copy).
source | the source knowledge base to copy from |
copy_set | a map of variables that should be copied. If empty, then everything is copied. If not empty, only the supplied variables will be copied. |
clean_copy | if true, clear the destination context (this) before copying. |
Definition at line 246 of file KnowledgeBase.inl.
|
inline |
Retrieves a stringified list of all modified variables that are ready to send over transport on next send_modifieds call.
Definition at line 1628 of file KnowledgeBase.inl.
|
inline |
Defines a function.
name | name of the function |
func | external function to call with this name |
Definition at line 1379 of file KnowledgeBase.inl.
|
inline |
Defines a named function that can distinguish the name it was called with in MADARA.
name | name of the function |
func | external function to call with this name |
Definition at line 1363 of file KnowledgeBase.inl.
|
inline |
Defines a MADARA KaRL function.
name | name of the function |
expression | KaRL function body |
Definition at line 1435 of file KnowledgeBase.inl.
|
inline |
Defines a MADARA KaRL function.
name | name of the function |
expression | KaRL function body |
Definition at line 1454 of file KnowledgeBase.inl.
|
inline |
Evaluates an expression.
expression | KaRL expression to evaluate |
settings | Settings for evaluating and printing |
Definition at line 1301 of file KnowledgeBase.inl.
|
inline |
Evaluates an expression.
expression | KaRL expression to evaluate (result of compile) |
settings | Settings for evaluating and printing |
Definition at line 1322 of file KnowledgeBase.inl.
|
inline |
Evaluates a root-based tree (result of compile)
root | root-based tree |
settings | Settings for evaluating and printing |
Definition at line 1342 of file KnowledgeBase.inl.
|
inline |
Checks if a knowledge location exists in the context.
key | knowledge variable location |
settings | settings for referring to knowledge variables |
Definition at line 1059 of file KnowledgeBase.inl.
|
inline |
Checks if a knowledge variable exists in the context.
variable | knowledge variable reference |
settings | settings for referring to knowledge variables |
Definition at line 1078 of file KnowledgeBase.inl.
|
inline |
Expands a statement using variable expansion.
For example, if the statement were MyKnowledge.{.id}, and .id==1, then the statement would be expanded to MyKnowledge.1
statement | statement to expand |
Definition at line 549 of file KnowledgeBase.inl.
|
inline |
Change the knowledge base to become a facade for another context.
It is extremely important that the context stays within scope for the duration of the life of this Knowledge Base. Otherwise, the Knowledge Base will eventually point to invalid memory
target | the target context to manipulate |
Definition at line 1710 of file KnowledgeBase.inl.
|
inline |
Retrieves a knowledge value.
key | knowledge location |
settings | settings for referring to knowledge variables |
Definition at line 295 of file KnowledgeBase.inl.
|
inline |
Atomically returns the value of a variable.
variable | reference to a variable ( |
settings | the settings for referring to variables |
Definition at line 331 of file KnowledgeBase.inl.
|
inline |
Returns the ThreadSafeContext associated with this Knowledge Base.
This is necessary for creating custom transports.
Definition at line 1553 of file KnowledgeBase.inl.
|
inline |
Returns the unique host and ephemeral binding for this Knowlede Base.
Definition at line 1649 of file KnowledgeBase.inl.
|
inline |
Gets the log level.
Definition at line 169 of file KnowledgeBase.inl.
|
inline |
Gets the logger used for information printing.
Definition at line 186 of file KnowledgeBase.inl.
|
inline |
Creates an iteration of VariableReferences to all keys matching the prefix and suffix.
prefix | string that the key must start with |
suffix | string that the key must end with |
matches | all VariableReferences matching the prefix and suffix |
Definition at line 1697 of file KnowledgeBase.inl.
|
inline |
Gets the number of transports.
Definition at line 1512 of file KnowledgeBase.inl.
|
inline |
Atomically returns a reference to the variable.
Variable references are efficient mechanisms for reference variables individually–similar to speedups seen from CompiledExpression.
key | unique identifier of the variable |
settings | settings for referring to knowledge variables |
Definition at line 313 of file KnowledgeBase.inl.
|
inline |
Loads the context from a file.
filename | name of the file to open |
use_id | if true, sets the unique identifier to the one found in the saved context. If false, keeps the default identifier. |
settings | settings to use when applying updates to context |
Definition at line 1941 of file KnowledgeBase.inl.
|
inline |
Loads the context from a file.
filename | name of the file to open |
meta | a file header that will contain metadata such as originator, timestamp, lamport clock, etc. |
use_id | if true, sets the unique identifier to the one found in the saved context. If false, keeps the default identifier. |
settings | settings for applying the update |
Definition at line 1962 of file KnowledgeBase.inl.
|
inline |
Loads the context from a file.
checkpoint_settings | checkpoint settings to load |
update_settings | settings for applying the updates |
Definition at line 1983 of file KnowledgeBase.inl.
|
inline |
Locks the context to prevent updates over the network.
Definition at line 143 of file KnowledgeBase.inl.
|
inline |
Marks the variable reference as updated.
variable | reference to a variable ( |
settings | settings for applying the update |
Definition at line 567 of file KnowledgeBase.inl.
|
inline |
Marks the variable as updated.
name | name of the variable |
settings | settings for applying the update |
Definition at line 582 of file KnowledgeBase.inl.
|
inline |
Alias for apply_modified.
settings | Settings for evaluating and printing |
Definition at line 2029 of file KnowledgeBase.inl.
|
default |
Assigns another instance's knowledge and settings to this instance.
original | knowledge base to copy |
|
inline |
Prints all knowledge variables and values in the context.
level | level to log the knowledge at |
Definition at line 1152 of file KnowledgeBase.inl.
|
inline |
Expands and prints a user provided statement at a logging level.
For example, if the statement were MyKnowledge.{.id}, and .id==1, then the statement would be expanded to MyKnowledge.1
statement | statement to expand with variable values |
level | level to log the knowledge at |
Definition at line 1200 of file KnowledgeBase.inl.
|
inline |
Deprecated alias for.
level | level to log the knowledge at |
Definition at line 1166 of file KnowledgeBase.inl.
|
inline |
Read a file into the knowledge base.
filename | file to read |
knowledge_key | key to store the file into |
settings | settings to use when evaluating/updating |
Definition at line 389 of file KnowledgeBase.inl.
|
inline |
Atomically reads a file into a variable.
variable | reference to a variable ( |
filename | file to read |
settings | settings for applying the update |
Definition at line 409 of file KnowledgeBase.inl.
|
inline |
Read a policy into the knowledge base.
policy_key | key to read the policy into |
policy_file | file to read the policy from |
Definition at line 519 of file KnowledgeBase.inl.
|
inline |
Releases a recursive lock on the knowledge base.
This will allow other thread to access the knowledge base if you had previously called @ acquire.
Definition at line 1271 of file KnowledgeBase.inl.
|
inline |
Removes a transport.
index | index of the transport to remove. If invalid, nothing is removed. |
Definition at line 1539 of file KnowledgeBase.inl.
void madara::knowledge::KnowledgeBase::reset_checkpoint | ( | void | ) | const |
Resets the local changed map, which tracks checkpointing modifieds.
|
inline |
Retrieves a value at a specified index within a knowledge array.
key | knowledge location |
index | index within the array |
settings | settings for referring to knowledge variables |
Definition at line 350 of file KnowledgeBase.inl.
|
inline |
Retrieves a value at a specified index within a knowledge array.
variable | reference to a variable ( |
index | index within the array |
settings | settings for referring to knowledge variables |
Definition at line 369 of file KnowledgeBase.inl.
|
inline |
Saves the context to a file as JSON.
filename | name of the file to save to |
Definition at line 1831 of file KnowledgeBase.inl.
|
inline |
Saves the context to a file as JSON.
settings | the settings to save |
Definition at line 1849 of file KnowledgeBase.inl.
|
inline |
Saves the context to a file as karl assignments, rather than binary.
filename | name of the file to save to |
Definition at line 1867 of file KnowledgeBase.inl.
|
inline |
Saves the context to a file as karl assignments, rather than binary.
settings | the settings to save |
Definition at line 1885 of file KnowledgeBase.inl.
|
inline |
Saves a checkpoint of a list of changes to a file.
filename | name of the file to open |
reset_modifieds | if true, resets the modified list to empty. |
Definition at line 1904 of file KnowledgeBase.inl.
|
inline |
Saves a checkpoint of a list of changes to a file.
settings | checkpoint settings to load |
id | unique identifier of the context holder |
Definition at line 1923 of file KnowledgeBase.inl.
|
inline |
Saves the context to a file.
filename | name of the file to save to |
Definition at line 1794 of file KnowledgeBase.inl.
|
inline |
Saves the context to a file.
settings | the settings to save |
Definition at line 1812 of file KnowledgeBase.inl.
|
inline |
Saves the list of modified records to use later for resending.
This does not clear the modified list. This feature is useful if you want to remember what has been modified and then resend later, e.g., if you believe packets may be dropped and want to resend information. Use this function in conjunction with
Definition at line 1596 of file KnowledgeBase.inl.
|
inline |
Sends all modified variables through the attached transports.
prefix | for logging purposes, the descriptor prefix for calling method |
settings | settings for sending modifications |
Definition at line 1613 of file KnowledgeBase.inl.
|
inline |
Atomically sets the value of a variable to a string.
variable | reference to a variable ( |
value | new value of the variable |
settings | settings for applying the update |
Definition at line 982 of file KnowledgeBase.inl.
|
inline |
Atomically sets the value of a variable to a string.
variable | reference to a variable ( |
value | new value of the variable |
settings | settings for applying the update |
Definition at line 1021 of file KnowledgeBase.inl.
|
inline |
Atomically sets the value of a variable to a KnowledgeRecord.
variable | reference to a variable ( |
value | new value of the variable |
settings | settings for applying the update |
Definition at line 657 of file KnowledgeBase.inl.
|
inline |
Atomically sets the value of a variable to a KnowledgeRecord.
variable | reference to a variable ( |
value | new value of the variable |
settings | settings for applying the update |
Definition at line 597 of file KnowledgeBase.inl.
|
inline |
Atomically sets the value of a variable to a KnowledgeRecord.
variable | reference to a variable ( |
value | new value of the variable |
settings | settings for applying the update |
Definition at line 617 of file KnowledgeBase.inl.
|
inline |
Atomically sets the value of a variable to a KnowledgeRecord.
variable | reference to a variable ( |
value | new value of the variable |
settings | settings for applying the update |
Definition at line 637 of file KnowledgeBase.inl.
|
inline |
Atomically sets the value of a variable to an integer 1.
variable | reference to a variable ( |
value | new value of the variable |
settings | settings for applying the update |
Definition at line 658 of file KnowledgeBase.h.
|
inline |
Atomically sets the value of a variable to a double array.
variable | reference to a variable ( |
value | a STL vector of doubles |
settings | settings for applying the update |
Definition at line 923 of file KnowledgeBase.inl.
|
inline |
Atomically sets the value of a variable to a double array.
variable | reference to a variable ( |
value | a STL vector of doubles |
settings | settings for applying the update |
Definition at line 943 of file KnowledgeBase.inl.
|
inline |
Atomically sets the value of a variable to a double array.
variable | reference to a variable ( |
value | an array of doubles |
size | number of elements in the array |
settings | settings for applying the update |
Definition at line 862 of file KnowledgeBase.inl.
|
inline |
Atomically sets the value of a variable to a double.
variable | reference to a variable ( |
value | new value of the variable |
settings | settings for applying the update |
Definition at line 69 of file KnowledgeBase.inl.
|
inline |
Atomically sets the value of a variable to an integer array.
variable | reference to a variable ( |
value | a STL vector of Integers |
settings | settings for applying the update |
Definition at line 781 of file KnowledgeBase.inl.
|
inline |
Atomically sets the value of a variable to an integer array.
variable | reference to a variable ( |
value | a STL vector of Integers |
settings | settings for applying the update |
Definition at line 821 of file KnowledgeBase.inl.
|
inline |
Atomically sets the value of a variable to an integer array.
variable | reference to a variable ( |
value | an array of Integers |
size | number of elements in the array |
settings | settings for applying the update |
Definition at line 740 of file KnowledgeBase.inl.
int madara::knowledge::KnowledgeBase::set | ( | const VariableReference & | variable, |
T | value, | ||
const EvalSettings & | settings = EvalSettings(false, false, true, false, false) |
||
) |
Atomically sets the value of a variable to an integer.
variable | reference to a variable ( |
value | new value of the variable |
settings | settings for applying the update |
|
inline |
Sets a knowledge variable to a specified value.
key | knowledge variable location |
value | value to set at location |
settings | settings for applying the update |
Definition at line 46 of file KnowledgeBase.inl.
|
inline |
Sets a knowledge variable to a specified value.
key | knowledge variable location |
value | array of integers to set at the location |
size | number of elements in the array |
settings | settings for applying the update |
Definition at line 719 of file KnowledgeBase.inl.
|
inline |
Sets a knowledge variable to a specified value.
key | knowledge variable location |
value | array of integers to set at the location |
settings | settings for applying the update |
Definition at line 761 of file KnowledgeBase.inl.
|
inline |
Sets a knowledge variable to a specified value.
key | knowledge variable location |
value | array of integers to set at the location |
settings | settings for applying the update |
Definition at line 801 of file KnowledgeBase.inl.
|
inline |
Atomically sets the value of a variable to an integer 1.
variable | reference to a variable ( |
value | new value of the variable |
settings | settings for applying the update |
Definition at line 1120 of file KnowledgeBase.h.
int madara::knowledge::KnowledgeBase::set | ( | const std::string & | key, |
T | value, | ||
const EvalSettings & | settings = EvalSettings(false, false, true, false, false) |
||
) |
Sets a knowledge variable to a specified value.
key | knowledge variable location |
value | value to set at location |
settings | settings for applying the update |
|
inline |
Sets a knowledge variable to a specified value.
key | knowledge variable location |
value | array of doubles to set at the location |
size | number of elements in the array |
settings | settings for applying the update |
Definition at line 841 of file KnowledgeBase.inl.
|
inline |
Sets a knowledge variable to a specified value.
key | knowledge variable location |
value | array of doubles to set at the location |
settings | settings for applying the update |
Definition at line 883 of file KnowledgeBase.inl.
|
inline |
Sets a knowledge variable to a specified value.
key | knowledge variable location |
value | array of doubles to set at the location |
settings | settings for applying the update |
Definition at line 903 of file KnowledgeBase.inl.
|
inline |
Sets a knowledge variable to a specified value.
key | knowledge variable location |
value | value to set at location |
settings | settings for applying the update |
Definition at line 963 of file KnowledgeBase.inl.
|
inline |
Sets a knowledge variable to a specified value.
key | knowledge variable location |
value | value to set at location |
settings | settings for applying the update |
Definition at line 1002 of file KnowledgeBase.inl.
|
inline |
Atomically sets the value of a variable to an arbitrary string.
key | name of a variable |
value | new value of the variable |
size | indicates the size of the value buffer |
settings | settings for applying the update |
Definition at line 429 of file KnowledgeBase.inl.
|
inline |
Atomically sets the value of a variable to an arbitrary string.
variable | reference to a variable ( |
value | new value of the variable |
size | indicates the size of the value buffer |
settings | settings for applying the update |
Definition at line 454 of file KnowledgeBase.inl.
|
inline |
Atomically sets the value of an array index to a value.
variable | reference to a variable ( |
index | index within array |
value | new value of the array index |
settings | settings for applying the update |
Definition at line 699 of file KnowledgeBase.inl.
|
inline |
Sets an index within an array to a specified value.
key | knowledge variable location |
index | index of the location in the array |
value | value to set at location |
settings | settings for applying the update |
Definition at line 678 of file KnowledgeBase.inl.
|
inline |
Atomically sets the value of a variable to a JPEG image.
key | name of a variable |
value | new value of the variable |
size | indicates the size of the value buffer |
settings | settings for applying the update |
Definition at line 474 of file KnowledgeBase.inl.
|
inline |
Atomically sets the value of a variable to a JPEG image.
variable | reference to a variable ( |
value | new value of the variable |
size | indicates the size of the value buffer |
settings | settings for applying the update |
Definition at line 499 of file KnowledgeBase.inl.
|
inline |
Sets the log level.
level | the maximum detail level to print |
Definition at line 213 of file KnowledgeBase.inl.
|
inline |
Sets the quality of writing to a certain variable from this entity.
Set quality of writing to a variable.
key | knowledge variable location |
quality | quality of writing to this location |
settings | settings for referring to knowledge variables |
Definition at line 1043 of file KnowledgeBase.inl.
int madara::knowledge::KnowledgeBase::set_text | ( | const VariableReference & | variable, |
const char * | value, | ||
size_t | size, | ||
const EvalSettings & | settings = EvalSettings(false, false, true, false, false) |
||
) |
Atomically sets the value of a variable to a text file's contents.
variable | reference to a variable ( |
value | new value of the variable |
size | indicates the size of the value buffer |
settings | settings for applying the update |
int madara::knowledge::KnowledgeBase::set_xml | ( | const VariableReference & | variable, |
const char * | value, | ||
size_t | size, | ||
const EvalSettings & | settings = EvalSettings(false, false, true, false, false) |
||
) |
Atomically sets the value of a variable to an XML string.
variable | reference to a variable ( |
value | new value of the variable |
size | indicates the size of the value buffer |
settings | settings for applying the update |
|
inline |
Binds to an ephemeral port for unique tie breakers in global ordering.
Call this function if you want to generate a unique id for a custom transport to use (or a built-in transport if you are creating one outside of the KnowledgeBase.
host | unique host identifier string ("" if requesting a generated id. |
Definition at line 2015 of file KnowledgeBase.inl.
|
inline |
Returns a shared_ptr, sharing with the internal one.
If this record is not a binary file, returns NULL shared_ptr
Definition at line 448 of file KnowledgeBase.h.
|
inline |
Returns a shared_ptr, sharing with the internal one.
If this record is not a binary file, returns NULL shared_ptr
Definition at line 469 of file KnowledgeBase.h.
|
inline |
Returns a shared_ptr, sharing with the internal one.
If this record is not a doubles array, returns NULL shared_ptr
Definition at line 364 of file KnowledgeBase.h.
|
inline |
Returns a shared_ptr, sharing with the internal one.
If this record is not a doubles array, returns NULL shared_ptr
Definition at line 385 of file KnowledgeBase.h.
|
inline |
Returns a shared_ptr, sharing with the internal one.
If this record is not an integer array, returns NULL shared_ptr
Definition at line 280 of file KnowledgeBase.h.
|
inline |
Returns a shared_ptr, sharing with the internal one.
If this record is not an integer array, returns NULL shared_ptr
Definition at line 301 of file KnowledgeBase.h.
|
inline |
Returns a shared_ptr, sharing with the internal one.
If this record is not a string, returns NULL shared_ptr
Definition at line 199 of file KnowledgeBase.h.
|
inline |
Returns a shared_ptr, sharing with the internal one.
If this record is not a string, returns NULL shared_ptr
Definition at line 219 of file KnowledgeBase.h.
|
inline |
Returns a shared_ptr, sharing with the internal one.
If this record is not a binary file, returns NULL shared_ptr
Definition at line 490 of file KnowledgeBase.h.
|
inline |
Returns a shared_ptr, sharing with the internal one.
If this record is not a binary file, returns NULL shared_ptr
Definition at line 511 of file KnowledgeBase.h.
|
inline |
Returns a shared_ptr, sharing with the internal one.
If this record is not a doubles array, returns NULL shared_ptr
Definition at line 406 of file KnowledgeBase.h.
|
inline |
Returns a shared_ptr, sharing with the internal one.
If this record is not a doubles array, returns NULL shared_ptr
Definition at line 427 of file KnowledgeBase.h.
|
inline |
Returns a shared_ptr, sharing with the internal one.
If this record is not an integer array, returns NULL shared_ptr
Definition at line 322 of file KnowledgeBase.h.
|
inline |
Returns a shared_ptr, sharing with the internal one.
If this record is not an integer array, returns NULL shared_ptr
Definition at line 343 of file KnowledgeBase.h.
|
inline |
Returns a shared_ptr, while resetting this record to empty.
If this record is not a string, returns NULL shared_ptr
Definition at line 239 of file KnowledgeBase.h.
|
inline |
Returns a shared_ptr, while resetting this record to empty.
If this record is not a string, returns NULL shared_ptr
Definition at line 259 of file KnowledgeBase.h.
|
inline |
Fills a variable map with Knowledge Records that match an expression.
At the moment, this expression must be of the form "subject*"
subject | An expression that matches the variable names that are of interest. Wildcards may only be at the end. |
target | The map that will be filled with variable names and the Knowledge Records they correspond to |
Definition at line 1718 of file KnowledgeBase.inl.
|
inline |
Fills a variable map with list of keys according to a matching prefix, suffix, and delimiter hierarchy.
This is useful for understanding the logical hierarchy of your variables (and also a key utility of containers like
prefix | Text that must be present at the front of the key |
delimiter | Text that signifies a logical boundary in hierarchy If empty, no check is performed. |
suffix | Text that must be present at the end of the key. If empty, no check is performed. |
next_keys | The immediate keys in the hierarchy after prefix |
result | The map that will be filled with full variable names and the Knowledge Records that correspond to |
just_keys | if true, do not fill result, only next_keys |
Definition at line 1737 of file KnowledgeBase.inl.
|
inline |
Creates a variable map with Knowledge Records that begin with the given prefix.
Runs in O(log n + m) time, where n is the size of the KnowledgeBase, and m is the number of matching records
prefix | Prefix string to match with |
Definition at line 1762 of file KnowledgeBase.inl.
|
inline |
Creates a map with Knowledge Records that begin with the given prefix.
Runs in O(log n + m) time, where n is the size of the KnowledgeBase, and m is the number of matching records
All key names have the "prefix" portion stripped off their front in the returned map.
prefix | Prefix string to match with |
Definition at line 1778 of file KnowledgeBase.inl.
|
inline |
Saves all keys and values into a string, using the underlying knowledge::KnowledgeRecord::to_string function.
This is an optimized version that allows the specification of a target string to avoid string copying (which can be expensive with longer strings across multiple function boundaries). This function differs from knowledge::KnowledgeRecord to_string in that it is intended to save the database in a format that can be easily parseable. Consequently, strings are delineated in this function by being included in single quotes. Arrays are delineated with array indices [].
This is not appropriate for saving the context if it has binary data inside of it, as only the size of the data entry would be saved.
target | where to store the resulting string operation. |
array_delimiter | for any arrays, the characters in between data elements. |
record_delimiter | the characters to place between individual key/value pairs |
key_val_delimiter | the characters to place between keys and values. |
Definition at line 1180 of file KnowledgeBase.inl.
|
inline |
Fills a vector with Knowledge Records that begin with a common subject and have a finite range of integer values.
subject | The common subject of the variable names. For instance, if we are looking for a range of vars like "var0", "var1", "var2", then the common subject would be "var". |
start | An inclusive start index |
end | An inclusive end index |
target | The vector that will be filled with Knowledge Record instances within the subject range. |
Definition at line 1676 of file KnowledgeBase.inl.
|
inline |
Returns a non-const reference to the Transport Settings.
Definition at line 1146 of file KnowledgeBase.inl.
|
inline |
Unlocks the context to allow updates over the network (is only necessary if the context has been explicitly locked)
Definition at line 156 of file KnowledgeBase.inl.
|
inline |
Refer to and use another knowledge base's context.
original | knowledge base to refer to |
Definition at line 135 of file KnowledgeBase.inl.
|
inline |
Waits for an expression to be non-zero.
Always disseminates modifications.
expression | KaRL expression to wait on |
settings | Settings for the underlying expression evaluation and printing |
Definition at line 1468 of file KnowledgeBase.inl.
KnowledgeRecord madara::knowledge::KnowledgeBase::wait | ( | CompiledExpression & | expression, |
const WaitSettings & | settings = WaitSettings () |
||
) |
Waits for an expression to be non-zero.
Provides additional settings for fine-tuning the time to wait and atomic print statements.
expression | KaRL expression to wait on (result of compile) |
settings | Settings for the underlying expression evaluation and printing |
The only situation this can be useful will be if the thread safe context is being used as a shared memory structure between threads. This should not be used for processes communicating together because the wait statement is unable to send modifieds as it has zero concept of transports. The type of knowledge base handled here is a facade for another knowledge base's context.
Definition at line 19 of file KnowledgeBase.cpp.
|
inline |
Wait for a change to happen to the context (e.g., from transports)
Definition at line 2002 of file KnowledgeBase.inl.
|
inline |
Write a file from the knowledge base to a specified location.
filename | file to write to |
knowledge_key | key to read the file from |
Definition at line 534 of file KnowledgeBase.inl.
|
private |
A knowledge base can also be a facade for another knowledge base.
Definition at line 1746 of file KnowledgeBase.h.
|
private |
Pointer to actual implementation, i.e., the "bridge", which is reference counted to automate memory management.
Definition at line 1743 of file KnowledgeBase.h.