summaryrefslogtreecommitdiff
path: root/starts/meaning-vm/level-0/concept.hpp
diff options
context:
space:
mode:
authorolpc user <olpc@xo-5d-f7-86.localdomain>2019-11-24 13:22:55 -0800
committerolpc user <olpc@xo-5d-f7-86.localdomain>2019-11-24 13:22:55 -0800
commit9a14918abec434d8463e07635daef380ad630649 (patch)
treefa1a5200da88ad6065092b05dc063a8a80df8faa /starts/meaning-vm/level-0/concept.hpp
parent50be8bb8697b23ff469de142eaebe9666c2a9537 (diff)
downloadstandingwithresilience-9a14918abec434d8463e07635daef380ad630649.tar.gz
standingwithresilience-9a14918abec434d8463e07635daef380ad630649.zip
breaking into levels
Diffstat (limited to 'starts/meaning-vm/level-0/concept.hpp')
-rw-r--r--starts/meaning-vm/level-0/concept.hpp38
1 files changed, 38 insertions, 0 deletions
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 <map>
+#include <vector>
+
+namespace intellect {
+namespace level0 {
+
+struct concept
+{
+ // a concept is made of concept-typed links to other concepts
+ std::multimap<ref,ref> links;
+ using array = std::vector<ref>;
+
+ 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 <typename T>
+ vref<T> vget(ref const & type) const { return get(type); }
+};
+
+}
+}