41#include <boost/lexical_cast.hpp>
45using boost::lexical_cast;
81 :
public Variant<DataValues>::Predicate
85#define DERIVE_EQUALITY(_TY_) \
86 virtual bool handle (_TY_ const& val) override { return (o_.get<_TY_>() == val); }
105 handle (
RecRef const& val)
override
116 EqualityTest visitor(o);
125 :
public Variant<DataValues>::Predicate
129#define MATCH_NUMBER(_TY_) \
130 virtual bool handle (_TY_ const& val) override { return val == num_; }
139 MatchNumber(int64_t num)
144 MatchNumber visitor(num);
153 :
public Variant<DataValues>::Predicate
157#define MATCH_DOUBLE(_TY_) \
158 virtual bool handle (_TY_ const& val) override { return almostEqual (double(val), num_); }
167 MatchDouble(
double d)
172 MatchDouble visitor(d);
181 :
public Variant<DataValues>::Predicate
185#define MATCH_STRING(_TY_) \
186 virtual bool handle (_TY_ const& val) override { return lexical_cast<string>(val) == txt_; }
194 virtual bool handle (
string const& str)
override {
return str == txt_; }
195 virtual bool handle (
char const& c )
override {
return 1 == txt_.length() and txt_.front() == c; }
198 MatchString(
string const& text)
203 MatchString visitor(text);
212 :
public Variant<DataValues>::Predicate
216#define MATCH_TIME(_TY_) \
217 virtual bool handle (_TY_ const& val) override { return val == t_; }
231 MatchTime visitor(
time);
239 bool* val = unConst(
this)->maybeGet<
bool>();
240 return val and (b == *val);
247 LuidH* val = unConst(
this)->maybeGet<
LuidH>();
248 return val and (
hash == *val);
260 return val and val->
empty();
268 Rec* val = unConst(
this)->maybeGet<
Rec>();
272 if (r) val = r->
get();
274 return val and (rec == *val);
280 DataCap::operator string()
const
282 return "DataCap|"+string(this->buffer());
294 return (n.isNamed()? n.idi.getSym()+
"=" :
"")
301 + (isnil(rec.
scope())?
"" :
"|")
310 return "Ref->" + (ref.
empty()? util::BOTTOM_INDICATOR
324 :
public Variant<diff::DataValues>::Renderer
326 #define RENDER_CONTENT(_TY_) \
327 virtual string handle (_TY_ const& val) override { return util::toString(val); }
339 #undef RENDER_CONTENT
341 virtual string handle (
string const& val)
override {
return val; }
344 virtual string handle (
Rec const& rec)
override {
return renderCompact(rec); }
348 return node.data.accept (visitor);
void accept(Visitor &visitor)
bool matchRec(RecRef const &) const
bool matchTxt(string const &) const
bool matchBool(bool) const
bool matchNum(int64_t) const
bool matchDbl(double) const
bool matchTime(time::TimeValue) const
bool matchData(DataCap const &) const
Implementation of content equality test, delgating to content.
bool matchLuid(hash::LuidH) const
wrapped record reference.
Target * get() const noexcept
object-like record of data.
static const string TYPE_NIL
scopeIter attribs() const
Hash implementation based on a lumiera unique object id (LUID) When invoking the default ctor,...
Duration is the internal Lumiera time metric.
Offset measures a distance in time.
A time interval anchored at a specific point in time.
basic constant internal time value.
Lumiera's internal time value datatype.
Fundamental definitions for a representation of changes.
Lumiera error handling (C++ interface).
#define DERIVE_EQUALITY(_TY_)
#define RENDER_CONTENT(_TY_)
#define MATCH_STRING(_TY_)
#define MATCH_DOUBLE(_TY_)
#define MATCH_NUMBER(_TY_)
Generic building block for tree shaped (meta)data structures.
string renderCompact(Rec const &rec)
compact textual representation of a Record<GenNode> (»object«).
Implementation namespace for support and library code.
auto transformIterator(IT const &src, FUN processingFunc)
Build a TransformIter: convenience free function shortcut, picking up the involved types automaticall...
bool almostEqual(double d1, double d2, unsigned int ulp=2)
epsilon comparison of doubles.
string showHash(size_t hash, uint showBytes) noexcept
renders the size_t in hex, optionally only trailing bytes
string join(COLL &&coll, string const &delim=", ")
enumerate a collection's contents, separated by delimiter.
generic data element node within a tree
static const Ref END
symbolic ID ref "_END_"
static const Ref I
symbolic ID ref "_I_"
static const Ref THIS
symbolic ID ref "_THIS_"
static const Ref NO
symbolic ID ref "_NO_"
static const Ref CHILD
symbolic ID ref "_CHILD_"
static const Ref ATTRIBS
symbolic ID ref "_ATTRIBS_"
Utilities for quantisation (grid alignment) and comparisons.
A typesafe union record to carry embedded values of unrelated type.