MCPcopy Create free account
hub / github.com/comaps/comaps / LoadTreeAsText

Function LoadTreeAsText

libs/indexer/tree_structure.hpp:11–49  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

9{
10template <class ToDo>
11bool LoadTreeAsText(std::istream & s, ToDo & toDo)
12{
13 std::string name;
14 s >> name;
15 ASSERT(!name.empty(), ("Error in classificator file"));
16 if (name == "{}")
17 return false;
18
19 // set key name
20 toDo.Name(name);
21
22 // load object itself
23 std::string strkey;
24 s >> strkey;
25 while (strkey != "+" && strkey != "-")
26 s >> strkey;
27
28 // load children
29 if (strkey == "+")
30 {
31 size_t i = 0;
32 while (true)
33 {
34 toDo.Start(i++);
35 bool const isContinue = LoadTreeAsText(s, toDo);
36 toDo.End();
37
38 if (!isContinue)
39 {
40 toDo.EndChilds();
41 break;
42 }
43 }
44
45 ASSERT(i <= 128, ("too many features at level = ", name));
46 }
47
48 return true;
49}
50} // namespace tree

Callers 1

ReadClassificatorMethod · 0.85

Calls 6

ASSERTFunction · 0.85
EndChildsMethod · 0.80
emptyMethod · 0.45
NameMethod · 0.45
StartMethod · 0.45
EndMethod · 0.45

Tested by

no test coverage detected