19 #ifndef _MADARA_NO_KARL_ 52 "KnowledgeBase::wait:" \
53 " waiting on %s\n", expression.
logic.c_str ());
58 "KnowledgeBase::wait:" \
59 " completed first eval to get %s\n",
60 last_value.to_string ().c_str ());
70 "KnowledgeBase::wait:" \
71 " last value didn't result in success\n");
89 "KnowledgeBase::wait:" \
90 " waiting on %s\n", expression.
logic.c_str ());
95 "KnowledgeBase::wait:" \
96 " completed eval to get %s\n",
97 last_value.to_string ().c_str ());
108 "KnowledgeBase::wait:" \
109 " Evaluate did not succeed. Timeout occurred\n");
118 else if (
impl_.get ())
120 result =
impl_->wait (expression, settings);
125 #endif // _MADARA_NO_KARL_ This class encapsulates an entry in a KnowledgeBase.
double max_wait_time
Maximum time to wait for an expression to become true (in seconds)
std::string pre_print_statement
Statement to print before evaluations.
int send_modifieds(const std::string &prefix="KnowledgeBase::send_modifieds", const EvalSettings &settings=EvalSettings())
Sends all modified variables through the attached transports.
void signal(bool lock=true) const
Signals that this thread is done with the context.
void print(unsigned int level) const
Atomically prints all variables and values in the context.
std::string logic
the logic that was compiled
Compiled, optimized KaRL logic.
#define madara_logger_log(logger, level,...)
Fast version of the madara::logger::log method.
std::string post_print_statement
Statement to print after evaluations.
std::shared_ptr< KnowledgeBaseImpl > impl_
Pointer to actual implementation, i.e., the "bridge", which is reference counted to automate memory m...
bool is_done(void) const
Checks to see if max duration is finished.
madara::expression::ExpressionTree expression
the expression tree
A thread-safe guard for a context or knowledge base.
ThreadSafeContext * context_
A knowledge base can also be a facade for another knowledge base.
madara::knowledge::KnowledgeRecord wait(const std::string &expression, const WaitSettings &settings=WaitSettings())
Waits for an expression to be non-zero.
Enforces a periodic epoch.
double poll_frequency
Frequency to poll an expression for truth (in seconds)
Integer to_integer(void) const
converts the value to an integer.
void wait_for_change(bool extra_release=false)
Wait for a change to happen to the context.
utility::EpochEnforcer< std::chrono::steady_clock > EpochEnforcer
Provides utility functions and classes for common tasks and needs.
Provides functions and classes for the distributed knowledge base.
Copyright (c) 2015 Carnegie Mellon University.
logger::Logger & get_logger(void) const
Gets the logger used for information printing.
Encapsulates settings for a wait statement.
madara::knowledge::KnowledgeRecord evaluate(const madara::knowledge::KnowledgeUpdateSettings &settings=knowledge::KnowledgeUpdateSettings())
Evaluates the expression tree.
void sleep_until_next(void)
Sleeps until the next epoch.