MCPcopy Create free account
hub / github.com/Icinga/icinga2 / Remove

Method Remove

lib/base/namespace.cpp:90–111  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

88}
89
90void Namespace::Remove(const String& field)
91{
92 ObjectLock olock(this);
93
94 if (m_Frozen) {
95 BOOST_THROW_EXCEPTION(ScriptError("Namespace is read-only and must not be modified."));
96 }
97
98 std::unique_lock<decltype(m_DataMutex)> dlock (m_DataMutex);
99
100 auto it = m_Data.find(field);
101
102 if (it == m_Data.end()) {
103 return;
104 }
105
106 if (it->second.Const) {
107 BOOST_THROW_EXCEPTION(ScriptError("Constants must not be removed."));
108 }
109
110 m_Data.erase(it);
111}
112
113/**
114 * Freeze the namespace, preventing further updates.

Callers

nothing calls this directly

Calls 4

ScriptErrorClass · 0.85
findMethod · 0.80
endMethod · 0.45
eraseMethod · 0.45

Tested by

no test coverage detected