2 #ifndef _MADARA_CONTAINERS_COUNTER_H_
3 #define _MADARA_CONTAINERS_COUNTER_H_
5 #ifndef _MADARA_NO_KARL_
9 #include "madara/LockType.h"
72 int counters,
type value = 0,
102 void operator=(
const Counter& rhs);
108 int get_id(
void)
const;
114 int get_counters(
void)
const;
224 void operator++(
void);
231 void operator--(
void);
244 double to_double(
void)
const;
264 void set_quality(uint32_t quality,
273 void resize(
int id = 0,
int counters = 1);
297 bool is_true(
void)
const;
303 bool is_false(
void)
const;
310 virtual bool is_true_(
void)
const;
316 virtual bool is_false_(
void)
const;
326 virtual void modify_(
void);
342 void build_aggregate_count(
void);
347 void build_var(
void);
352 void init_noharm(
void);
360 return context_->evaluate(aggregate_count_, no_harm).to_integer();
369 return context_->evaluate(aggregate_count_, no_harm).to_string();
378 return context_->evaluate(aggregate_count_, no_harm).to_double();
387 return context_->evaluate(aggregate_count_, no_harm);
const ThreadSafeContext * context_
Compiled, optimized KaRL logic.
This class provides a distributed knowledge base to users.
This class encapsulates an entry in a KnowledgeBase.
Settings for applying knowledge updates.
Settings for applying knowledge updates.
This class stores variables and their values for use by any entity needing state information in a thr...
Optimized reference to a variable within the knowledge base.
Provides an interface for external functions into the MADARA KaRL variable settings.
This class is an abstract base class for all containers.
This class stores an integer within a variable context.
CompiledExpression aggregate_count_
Expression for aggregating count in one atomic operation.
VariableReference variable_
Variable reference.
double get_count_double(void) const
Counts all counter variables.
std::string get_count_string(void) const
Counts all counter variables.
type get_count(void) const
Counts all counter variables.
EvalSettings no_harm
Settings we'll use for all evaluations.
knowledge::KnowledgeRecord::Integer type
trait that describes the value type
int counters_
the number of counters in the counter ring
int id_
id of this counter in the counter ring
ThreadSafeContext * context_
Variable context that we are modifying.
knowledge::KnowledgeRecord get_count_record(void) const
Counts all counter variables.
Provides container classes for fast knowledge base access and mutation.
Provides functions and classes for the distributed knowledge base.
auto operator==(const KnowledgeRecord &l, const T &r) -> decltype(knowledge_cast< T >(l)==r)
auto operator-=(KnowledgeRecord &l, const T &r) -> decltype(l -=knowledge_cast(r))
auto operator*(const KnowledgeRecord &l, const T &r) -> decltype(l *knowledge_cast(r))
auto operator>=(const KnowledgeRecord &l, const T &r) -> decltype(knowledge_cast< T >(l) >=r)
auto operator<(const KnowledgeRecord &l, const T &r) -> decltype(knowledge_cast< T >(l)< r)
auto operator!=(const KnowledgeRecord &l, const T &r) -> decltype(knowledge_cast< T >(l) !=r)
auto operator+=(KnowledgeRecord &l, const T &r) -> decltype(l+=knowledge_cast(r))
auto operator<=(const KnowledgeRecord &l, const T &r) -> decltype(knowledge_cast< T >(l)<=r)
auto operator>(const KnowledgeRecord &l, const T &r) -> decltype(knowledge_cast< T >(l) > r)
Copyright(c) 2020 Galois.
Encapsulates settings for an evaluation statement.