From 9a14918abec434d8463e07635daef380ad630649 Mon Sep 17 00:00:00 2001 From: olpc user Date: Sun, 24 Nov 2019 13:22:55 -0800 Subject: breaking into levels --- starts/meaning-vm/level-0/concept.hpp | 38 +++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 starts/meaning-vm/level-0/concept.hpp (limited to 'starts/meaning-vm/level-0/concept.hpp') diff --git a/starts/meaning-vm/level-0/concept.hpp b/starts/meaning-vm/level-0/concept.hpp new file mode 100644 index 0000000..dc3221b --- /dev/null +++ b/starts/meaning-vm/level-0/concept.hpp @@ -0,0 +1,38 @@ +#pragma once + +#include "common.hpp" +#include "ref.hpp" + +#include +#include + +namespace intellect { +namespace level0 { + +struct concept +{ + // a concept is made of concept-typed links to other concepts + std::multimap links; + using array = std::vector; + + ref id(); + + void link(ref const & type, ref const & target); + void unlink(ref const & type, ref const & target); + void unlink(ref const & type); + + bool linked(ref const & type) const; + bool linked(ref const & type, ref const & target) const; + + array getAll(ref const & type) const; + + // get and set enforce that only 1 link of a given type is present + ref get(ref const & type) const; + void set(ref const & type, ref const & target); + + template + vref vget(ref const & type) const { return get(type); } +}; + +} +} -- cgit v1.2.3