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

Function SerializeArray

lib/base/serializer.cpp:71–97  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

69static Value SerializeInternal(const Value& value, int attributeTypes, SerializeStack& stack, bool dryRun);
70
71static Array::Ptr SerializeArray(const Array::Ptr& input, int attributeTypes, SerializeStack& stack, bool dryRun)
72{
73 ArrayData result;
74
75 if (!dryRun) {
76 result.reserve(input->GetLength());
77 }
78
79 ObjectLock olock(input);
80
81 int index = 0;
82
83 for (const Value& value : input) {
84 stack.Push(Convert::ToString(index), value);
85
86 auto serialized (SerializeInternal(value, attributeTypes, stack, dryRun));
87
88 if (!dryRun) {
89 result.emplace_back(std::move(serialized));
90 }
91
92 stack.Pop();
93 index++;
94 }
95
96 return dryRun ? nullptr : new Array(std::move(result));
97}
98
99static Dictionary::Ptr SerializeDictionary(const Dictionary::Ptr& input, int attributeTypes, SerializeStack& stack, bool dryRun)
100{

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