2 #ifndef _MADARA_CONTAINERS_COUNTER_H_ 3 #define _MADARA_CONTAINERS_COUNTER_H_ 5 #ifndef _MADARA_NO_KARL_ 9 #include "madara/LockType.h" 115 void operator= (
const Counter & rhs);
121 int get_id (
void)
const;
127 int get_counters (
void)
const;
156 type operator= (type value);
259 double to_double (
void)
const;
279 void set_quality (uint32_t quality,
288 void resize (
int id = 0,
int counters = 1);
312 bool is_true (
void)
const;
318 bool is_false (
void)
const;
326 virtual bool is_true_ (
void)
const;
332 virtual bool is_false_ (
void)
const;
342 virtual void modify_ (
void);
358 void build_aggregate_count (
void);
363 void build_var (
void);
368 void init_noharm (
void);
376 return context_->evaluate (aggregate_count_, no_harm).to_integer ();
385 return context_->evaluate (aggregate_count_, no_harm).to_string ();
394 return context_->evaluate (aggregate_count_, no_harm).to_double ();
403 return context_->evaluate (aggregate_count_, no_harm);
440 #endif // _MADARA_NO_KARL_ 442 #endif // _MADARA_CONTAINERS_COUNTER_H_ This class encapsulates an entry in a KnowledgeBase.
auto operator>=(const Tracked< T > &lhs, const Tracked< U > &rhs) -> decltype(lhs.get() >=rhs.get())
auto operator>(const Tracked< T > &lhs, const Tracked< U > &rhs) -> decltype(lhs.get() >rhs.get())
auto operator<=(const Tracked< T > &lhs, const Tracked< U > &rhs) -> decltype(lhs.get()<=rhs.get())
auto operator<(const Tracked< T > &lhs, const Tracked< U > &rhs) -> decltype(lhs.get()< rhs.get())
int counters_
the number of counters in the counter ring
ThreadSafeContext * context_
Variable context that we are modifying.
auto operator--(Tracked< T > &lhs) -> decltype(--lhs.get_mut())
int id_
id of this counter in the counter ring
auto operator+=(Tracked< T > &lhs, const Tracked< U > &rhs) -> decltype(lhs.get_mut()+=rhs.get())
This class stores variables and their values for use by any entity needing state information in a thr...
VariableReference variable_
Variable reference.
Optimized reference to a variable within the knowledge base.
CompiledExpression aggregate_count_
Expression for aggregating count in one atomic operation.
Compiled, optimized KaRL logic.
Provides container classes for fast knowledge base access and mutation.
auto operator*(const Tracked< T > &lhs, const Tracked< U > &rhs) -> decltype(lhs.get()*rhs.get())
knowledge::KnowledgeRecord::Integer type
trait that describes the value type
This class provides a distributed knowledge base to users.
knowledge::KnowledgeRecord get_count_record(void) const
Counts all counter variables.
auto operator-=(Tracked< T > &lhs, const Tracked< U > &rhs) -> decltype(lhs.get_mut()-=rhs.get())
auto operator==(const Tracked< T > &lhs, const Tracked< U > &rhs) -> decltype(lhs.get()==rhs.get())
auto operator!=(const Tracked< T > &lhs, const Tracked< U > &rhs) -> decltype(lhs.get()!=rhs.get())
Encapsulates settings for an evaluation statement.
Provides functions and classes for the distributed knowledge base.
Settings for applying knowledge updates.
Copyright (c) 2015 Carnegie Mellon University.
This class stores an integer within a variable context.
std::string get_count_string(void) const
Counts all counter variables.
Settings for applying knowledge updates.
EvalSettings no_harm
Settings we'll use for all evaluations.
double get_count_double(void) const
Counts all counter variables.
Provides an interface for external functions into the MADARA KaRL variable settings.
This class is an abstract base class for all containers.
type get_count(void) const
Counts all counter variables.
auto operator++(Tracked< T > &lhs) -> decltype(++lhs.get_mut())