blob: dc3221bcda26564535fb879a9b54faba8343eede (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
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); }
};
}
}
|