xref: /openbmc/phosphor-logging/extensions/openpower-pels/callouts.cpp (revision 32f13c915fa4b27520ca0aea476804c37f5516b9)
1*32f13c91SMatt Spinler #include "callouts.hpp"
2*32f13c91SMatt Spinler 
3*32f13c91SMatt Spinler namespace openpower
4*32f13c91SMatt Spinler {
5*32f13c91SMatt Spinler namespace pels
6*32f13c91SMatt Spinler {
7*32f13c91SMatt Spinler namespace src
8*32f13c91SMatt Spinler {
9*32f13c91SMatt Spinler 
10*32f13c91SMatt Spinler Callouts::Callouts(Stream& pel)
11*32f13c91SMatt Spinler {
12*32f13c91SMatt Spinler     pel >> _subsectionID >> _subsectionFlags >> _subsectionWordLength;
13*32f13c91SMatt Spinler 
14*32f13c91SMatt Spinler     size_t currentLength = sizeof(_subsectionID) + sizeof(_subsectionFlags) +
15*32f13c91SMatt Spinler                            sizeof(_subsectionWordLength);
16*32f13c91SMatt Spinler 
17*32f13c91SMatt Spinler     while ((_subsectionWordLength * 4) > currentLength)
18*32f13c91SMatt Spinler     {
19*32f13c91SMatt Spinler         _callouts.emplace_back(new Callout(pel));
20*32f13c91SMatt Spinler         currentLength += _callouts.back()->flattenedSize();
21*32f13c91SMatt Spinler     }
22*32f13c91SMatt Spinler }
23*32f13c91SMatt Spinler 
24*32f13c91SMatt Spinler void Callouts::flatten(Stream& pel)
25*32f13c91SMatt Spinler {
26*32f13c91SMatt Spinler     pel << _subsectionID << _subsectionFlags << _subsectionWordLength;
27*32f13c91SMatt Spinler 
28*32f13c91SMatt Spinler     for (auto& callout : _callouts)
29*32f13c91SMatt Spinler     {
30*32f13c91SMatt Spinler         callout->flatten(pel);
31*32f13c91SMatt Spinler     }
32*32f13c91SMatt Spinler }
33*32f13c91SMatt Spinler 
34*32f13c91SMatt Spinler } // namespace src
35*32f13c91SMatt Spinler } // namespace pels
36*32f13c91SMatt Spinler } // namespace openpower
37