summaryrefslogtreecommitdiff
path: root/docs/data/core/tree_container.json
blob: 5f01db8386dfdec26296c62644a6d64708da8379 (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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
{
	"format": 1,
	"id": "saw-tree_container",
	"kind": "class",
	"name": "tree_container",
	"namespace": "saw",
	"module": "core",
	"header": "modules/core/c++/tree.hpp",
	"brief_description": "Tree object holding branches.",
	"detailed_description": [
		[
			"The name comes from the fact that a tree acts as a node while the",
			{"name": "branch", "id": "saw-branch"},
			"class is the edge to a leaf or to other nodes. A container holds the branches, and each branch either has a leaf or another sub tree."
		],
		[
			"Growing is done through add, which reports failure as a value instead of throwing, so a tree can be built in code which must not throw."
		]
	],
	"templates": [
		{"name": "T", "kind": "type", "brief_description": "Leaf value type."},
		{"name": "Tree", "kind": "type", "brief_description": "The tree type a branch may hold instead of a leaf."}
	],
	"attributes": {
		"saw-tree_container-children_": {
			"id": "saw-tree_container-children_",
			"name": "children_",
			"type": ["std::vector<", {"name": "branch", "id": "saw-branch"}, "< T, Tree > >"],
			"visibility": "private",
			"brief_description": "Object holding the branch instances."
		}
	},
	"functions": {
		"saw-tree_container-reserve": {
			"id": "saw-tree_container-reserve",
			"name": "reserve",
			"type": ["error_or< void >"],
			"brief_description": "Reserves room for branches up front.",
			"parameters": [
				{"name": "siz", "type": ["std::size_t"]}
			]
		},
		"saw-tree_container-add-1": {
			"id": "saw-tree_container-add-1",
			"name": "add",
			"type": ["error_or< std::size_t >"],
			"brief_description": "Adds a branch holding a leaf.",
			"parameters": [
				{"name": "leaf", "type": ["T"]}
			]
		},
		"saw-tree_container-add-2": {
			"id": "saw-tree_container-add-2",
			"name": "add",
			"type": ["error_or< std::size_t >"],
			"brief_description": "Adds a branch holding a sub tree."
		},
		"saw-tree_container-size": {
			"id": "saw-tree_container-size",
			"name": "size",
			"type": ["std::size_t"],
			"const": true,
			"brief_description": "Number of branches."
		},
		"saw-tree_container-at": {
			"id": "saw-tree_container-at",
			"name": "at",
			"type": [{"name": "branch", "id": "saw-branch"}, "< T, Tree > &"],
			"brief_description": "The branch at an index.",
			"parameters": [
				{"name": "i", "type": ["std::size_t"]}
			]
		}
	},
	"notes": [
		"Copy is forbidden, move is allowed."
	]
}