41using util::BOTTOM_INDICATOR;
80 string type_ = Rec::TYPE_NIL;
93 : key_(idi::EntryID<
Opaque>())
98 : key_(idi::EntryID<
Opaque>(keyID))
113 , nestedObj_(o.nestedObj_)
114 , nestedData_(o.nestedData_)
135 bool verifyData(
string desc)
const {
return desc == join(nestedData_); }
140 operator string()
const
142 return _Fmt{
"%s__(α:%d β:%s γ:%7.5f δ:%s\n......|nested:%s\n......|data:%s\n )__END_%s"}
148 % join (nestedObj_,
"\n......|")
157 string symbol = key_.
getSym() + (isTyped()?
"≺"+type_+
"≻" :
"");
164 return Rec::TYPE_NIL != type_;
197 .attach (collection(nestedData_)
198 .isApplicableIf ([&](
GenNode const& spec) ->
bool
202 .matchElement ([&](
GenNode const& spec,
string const& elm) ->
bool
204 return elm == render(spec.
data);
206 .constructFrom ([&](
GenNode const& spec) ->
string
208 return render (spec.
data);
210 .assignElement ([&](
string& target,
GenNode const& spec) ->
bool
212 target = render (spec.
data);
215 .attach (collection(nestedObj_)
216 .isApplicableIf ([&](
GenNode const& spec) ->
bool
220 .matchElement ([&](
GenNode const& spec,
Opaque const& elm) ->
bool
222 return spec.
idi == elm.key_;
230 target.buildMutator (buff);
233 .change(
"type", [&](
string typeID)
237 .change(
"α", [&](
int val)
241 .change(
"β", [&](int64_t val)
245 .change(
"γ", [&](
double val)
252 delta_.reset (
new Opaque(
"δ"));
255 delta_->buildMutator(buff);
263 friend constexpr size_t
306 return snapshot({ins(ATTRIB1)
331 return snapshot({after(CHILD_B)
362 cout <<
"before..."<<endl << subject<<endl;
363 CHECK (subject.verifyAlpha(-1));
364 CHECK (subject.verifyBeta(-1));
365 CHECK (subject.verifyGamma(-1));
366 CHECK (not subject.nestedDelta());
367 CHECK (not subject.nestedObj_1());
368 CHECK (subject.verifyData(
""));
374 cout <<
"after...I"<<endl << subject<<endl;
376 CHECK (subject.verifyAlpha(1));
377 CHECK (subject.verifyGamma(ATTRIB3.
data.
get<
double>()));
378 CHECK (subject.verifyData(
"b, b, 78:56:34.012"));
380 CHECK (subject.verifyBeta(-1));
381 CHECK (not subject.nestedDelta());
382 CHECK (not subject.nestedObj_1());
388 cout <<
"after...II"<<endl << subject<<endl;
390 CHECK (subject.verifyAlpha(1));
391 CHECK (subject.verifyBeta (2));
392 CHECK (subject.verifyGamma(3.45));
393 CHECK (subject.verifyData(
"78:56:34.012, b"));
394 CHECK (subject.nestedObj_1());
396 CHECK (subject.nestedObj_1()->verifyBeta(-1));
397 CHECK (subject.nestedObj_1()->verifyData(
""));
403 cout <<
"after...III"<<endl << subject<<endl;
408 CHECK (subject.verifyAlpha(1));
409 CHECK (subject.verifyBeta (2));
410 CHECK (subject.verifyGamma(GAMMA_PI.
data.
get<
double>()));
411 CHECK (subject.nestedDelta());
412 CHECK (subject.nestedDelta()->verifyType(
"ζ"));
413 CHECK (subject.nestedDelta()->verifyData(
"a, a, a"));
414 CHECK (subject.verifyData(
"78:56:34.012, b"));
415 CHECK (subject.nestedObj_1()->verifyType(
"ξ"));
416 CHECK (subject.nestedObj_1()->verifyBeta(2));
417 CHECK (subject.nestedObj_1()->verifyData(
"b, a"));
A handle to allow for safe »remote implantation« of an unknown subclass into a given opaque InPlaceBu...
SUB & emplace(SUB &&implementation)
move-construct an instance of a subclass into the opaque buffer
bool isNested() const
determine if payload constitutes a nested scope ("object")
generic builder to apply a diff description to a given target data structure.
void consume(DIFF &&diff)
static const string TYPE_NIL
iter_stl::IterSnapshot< DiffStep > DiffSeq
opaque private data structure to apply the diff.
void buildMutator(TreeMutator::Handle buff)
the only way this opaque object exposes itself for mutation through diff messages.
vector< Opaque > nestedObj_
bool verifyBeta(int64_t x) const
unique_ptr< Opaque > delta_
vector< string > nestedData_
bool verifyType(string x) const
bool verifyData(string desc) const
friend constexpr size_t treeMutatorSize(const Opaque *)
override default size traits to allow for sufficient buffer, able to hold the mutator defined above.
const Opaque * nestedObj_1() const
const Opaque * nestedDelta() const
bool verifyGamma(double x) const
bool verifyAlpha(int x) const
Opaque(idi::BareEntryID id)
type erased baseclass for building a combined hash and symbolic ID.
LuidH const & getHash() const
string const & getSym() const
materialised iterator contents.
Lumiera's internal time value datatype.
A front-end for using printf-style formatting.
Preconfigured adapters for some STL container standard usage situations.
const GenNode CHILD_T(Time(12, 34, 56, 78))
const GenNode ATTRIB3("γ", 3.45)
const GenNode ATTRIB_NODE
const GenNode GAMMA_PI("γ", 3.14159265)
const GenNode TYPE_Z("type", "ζ")
const GenNode ATTRIB2("β", int64_t(2))
const GenNode ATTRIB1("α", 1)
const GenNode TYPE_X("type", "ξ")
const GenNode CHILD_A("a")
const GenNode CHILD_B('b')
ContentSnapshot< CON > snapshot(CON const &con)
Take a snapshot of the given STL compliant container.
Implementation namespace for support and library code.
Test runner and basic definitions for tests.
string join(COLL &&coll, string const &delim=", ")
enumerate a collection's contents, separated by delimiter.
bool isnil(lib::time::Duration const &dur)
Simplistic test class runner.
#define LAUNCHER(_TEST_CLASS_, _GROUPS_)
generic data element node within a tree
static const Ref END
symbolic ID ref "_END_"
static const Ref ATTRIBS
symbolic ID ref "_ATTRIBS_"
Diagnostic helper for unit tests regarding mutation of custom data.
a family of time value like entities and their relationships.
Concrete implementation to apply structural changes to hierarchical data structures.
Tiny helper functions and shortcuts to be used everywhere Consider this header to be effectively incl...