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

Function SerializeDictionary

lib/base/serializer.cpp:99–122  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

97}
98
99static Dictionary::Ptr SerializeDictionary(const Dictionary::Ptr& input, int attributeTypes, SerializeStack& stack, bool dryRun)
100{
101 DictionaryData result;
102
103 if (!dryRun) {
104 result.reserve(input->GetLength());
105 }
106
107 ObjectLock olock(input);
108
109 for (const Dictionary::Pair& kv : input) {
110 stack.Push(kv.first, kv.second);
111
112 auto serialized (SerializeInternal(kv.second, attributeTypes, stack, dryRun));
113
114 if (!dryRun) {
115 result.emplace_back(kv.first, std::move(serialized));
116 }
117
118 stack.Pop();
119 }
120
121 return dryRun ? nullptr : new Dictionary(std::move(result));
122}
123
124static Dictionary::Ptr SerializeNamespace(const Namespace::Ptr& input, int attributeTypes, SerializeStack& stack, bool dryRun)
125{

Callers 1

SerializeInternalFunction · 0.85

Calls 4

SerializeInternalFunction · 0.85
PopMethod · 0.80
GetLengthMethod · 0.45
PushMethod · 0.45

Tested by

no test coverage detected