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

Method Push

lib/base/serializer.cpp:41–61  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

39 std::deque<SerializeStackEntry> Entries;
40
41 inline void Push(const String& name, const Value& val)
42 {
43 Object::Ptr obj;
44
45 if (val.IsObject())
46 obj = val;
47
48 if (obj) {
49 for (const auto& entry : Entries) {
50 if (entry.Val == obj) {
51 std::vector<String> path;
52 for (const auto& entry : Entries)
53 path.push_back(entry.Name);
54 path.push_back(name);
55 BOOST_THROW_EXCEPTION(CircularReferenceError("Cannot serialize object which recursively refers to itself. Attribute path which leads to the cycle: " + boost::algorithm::join(path, " -> "), path));
56 }
57 }
58 }
59
60 Entries.push_back({ name, obj });
61 }
62
63 inline void Pop()
64 {

Callers 4

SerializeArrayFunction · 0.45
SerializeDictionaryFunction · 0.45
SerializeNamespaceFunction · 0.45
SerializeObjectFunction · 0.45

Calls 3

IsObjectMethod · 0.80
push_backMethod · 0.80

Tested by

no test coverage detected