MCPcopy Create free account
hub / github.com/covscript/covscript / domain_manager

Class domain_manager

include/covscript/impl/runtime.hpp:32–356  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

30 using stack_pointer = stack_type<domain_type> *;
31
32 class domain_manager {
33 const stack_pointer &fiber_stack;
34 stack_type<set_t<std::string_view>> m_set;
35 stack_type<domain_type> m_data;
36 set_t<std::string_view> buildin_symbols;
37
38 public:
39 explicit domain_manager(const stack_pointer &fiber_sp) : fiber_stack(fiber_sp)
40 {
41 m_set.push();
42 m_data.push();
43 }
44
45 domain_manager(const stack_pointer &fiber_sp, std::size_t size) : fiber_stack(fiber_sp)
46 {
47 m_set.push();
48 m_data.resize(size);
49 m_data.push();
50 }
51
52 domain_manager(const domain_manager &) = delete;
53
54 ~domain_manager() = default;
55
56 void clear_all_data()
57 {
58 while (!m_set.empty())
59 m_set.pop_no_return();
60 while (!m_data.empty()) {
61 m_data.top().clear();
62 m_data.pop_no_return();
63 }
64 }
65
66 bool is_initial() const
67 {
68 return m_data.size() == 1;
69 }
70
71 void add_set()
72 {
73 m_set.push();
74 }
75
76 void add_domain()
77 {
78 if (fiber_stack != nullptr)
79 fiber_stack->push();
80 else
81 m_data.push();
82 }
83
84 domain_type &get_domain() const
85 {
86 if (fiber_stack != nullptr)
87 return fiber_stack->top();
88 else
89 return m_data.top();

Callers

nothing calls this directly

Calls 6

runtime_errorClass · 0.85
get_var_optMethod · 0.80
sizeMethod · 0.80
consistenceMethod · 0.80
add_var_optimalMethod · 0.80
existMethod · 0.45

Tested by

no test coverage detected