summaryrefslogtreecommitdiff
path: root/starts/meaning-vm/level-0/baseref.hpp
diff options
context:
space:
mode:
authorolpc user <olpc@xo-5d-f7-86.localdomain>2019-12-26 08:25:31 -0800
committerolpc user <olpc@xo-5d-f7-86.localdomain>2019-12-26 08:25:31 -0800
commitff4aecf759ce565b77575ad8eabcf60c94ee6a29 (patch)
treea208e19b28b3142dce765a0eaec1cb7263e6258b /starts/meaning-vm/level-0/baseref.hpp
parent2e93105a29236f7b5d3c7a40e860604185e0b023 (diff)
downloadstandingwithresilience-ff4aecf759ce565b77575ad8eabcf60c94ee6a29.tar.gz
standingwithresilience-ff4aecf759ce565b77575ad8eabcf60c94ee6a29.zip
added crucialness to inner level0
Diffstat (limited to 'starts/meaning-vm/level-0/baseref.hpp')
-rw-r--r--starts/meaning-vm/level-0/baseref.hpp22
1 files changed, 20 insertions, 2 deletions
diff --git a/starts/meaning-vm/level-0/baseref.hpp b/starts/meaning-vm/level-0/baseref.hpp
index 9244492..b6e98e8 100644
--- a/starts/meaning-vm/level-0/baseref.hpp
+++ b/starts/meaning-vm/level-0/baseref.hpp
@@ -13,8 +13,8 @@ namespace level0 {
template <typename ref>
class baseref
{
- struct array; struct links_t;
public:
+ struct array; struct links_t;
baseref(concept *p)
: p(p)
{
@@ -63,6 +63,9 @@ public:
T& val() { return p->val<T>(); }
template <typename T>
void val(T const & v) { p->val<T>(v); }
+ bool hasval() { return p->hasval(); }
+ template <typename T>
+ bool hasvalof() { return p->hasvalof<T>(); }
operator concept*() const { return p; }
concept*& ptr() { return p; }
@@ -91,9 +94,15 @@ public:
operator level9::ref &() { return *reinterpret_cast<level9::ref*>(this); }
bool operator==(ref const & other) const { return self.p == other.p; }
- bool operator!=(ref const & other) const { return self.p == other.p; }
+ bool operator!=(ref const & other) const { return self.p != other.p; }
bool operator<(ref const & other) const { return self.p < other.p; }
+ bool crucial() { return self.p->crucial(); }
+ bool crucial(ref type, ref target) { return self.p->crucial(type.p, target.p); }
+
+ void setcrucial() { self.p->setcrucial(); }
+ void setcrucial(ref type, ref target) { self.p->setcrucial(type.p, target.p); }
+
protected:
concept * p;
@@ -107,16 +116,21 @@ private:
mutit & operator++() { ++ self.it; return self; }
mutit operator++(int i) { return self.it.operator++(i); }
+ mutit & operator--() { -- self.it; return self; }
+ mutit operator--(int i) { return self.it.operator--(i); }
bool operator==(mutit const & other) const { return self.it == other.it; }
bool operator!=(mutit const & other) const { return self.it != other.it; }
val & operator*() { return *(val*)&self.it.operator*(); }
val * operator->() { return (val*)self.it.operator->(); }
+ It & underlying() { return it; }
+
private:
It it;
};
+public:
struct array
{
using iterator = mutated_it<ref,typename concept::array::iterator>;
@@ -134,6 +148,10 @@ private:
decltype(concept::links) & links;
};
+
+ void unlink(typename links_t::iterator & it) { p->unlink(it.underlying()); }
+ bool crucial(typename links_t::iterator it) { return self.p->crucial(it.underlying()); }
+ void setcrucial(typename links_t::iterator it) { self.p->setcrucial(it.underlying()); }
};
template <typename ref>