Matt Spinler | 32f13c9 | 2019-10-09 12:48:25 -0500 | [diff] [blame] | 1 | #include "callouts.hpp" |
| 2 | |
| 3 | namespace openpower |
| 4 | { |
| 5 | namespace pels |
| 6 | { |
| 7 | namespace src |
| 8 | { |
| 9 | |
| 10 | Callouts::Callouts(Stream& pel) |
| 11 | { |
| 12 | pel >> _subsectionID >> _subsectionFlags >> _subsectionWordLength; |
| 13 | |
| 14 | size_t currentLength = sizeof(_subsectionID) + sizeof(_subsectionFlags) + |
| 15 | sizeof(_subsectionWordLength); |
| 16 | |
| 17 | while ((_subsectionWordLength * 4) > currentLength) |
| 18 | { |
| 19 | _callouts.emplace_back(new Callout(pel)); |
| 20 | currentLength += _callouts.back()->flattenedSize(); |
| 21 | } |
| 22 | } |
| 23 | |
| 24 | void Callouts::flatten(Stream& pel) |
| 25 | { |
| 26 | pel << _subsectionID << _subsectionFlags << _subsectionWordLength; |
| 27 | |
| 28 | for (auto& callout : _callouts) |
| 29 | { |
| 30 | callout->flatten(pel); |
| 31 | } |
| 32 | } |
| 33 | |
| 34 | } // namespace src |
| 35 | } // namespace pels |
| 36 | } // namespace openpower |