blob: 17f5bdd76ed1b918fcb6285791ca6980b3fdedaf [file] [log] [blame]
Matt Spinler711d51d2019-11-06 09:36:51 -06001/**
2 * Copyright © 2019 IBM Corporation
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
Matt Spinler32f13c92019-10-09 12:48:25 -050016#include "callouts.hpp"
17
18namespace openpower
19{
20namespace pels
21{
22namespace src
23{
24
25Callouts::Callouts(Stream& pel)
26{
27 pel >> _subsectionID >> _subsectionFlags >> _subsectionWordLength;
28
29 size_t currentLength = sizeof(_subsectionID) + sizeof(_subsectionFlags) +
30 sizeof(_subsectionWordLength);
31
32 while ((_subsectionWordLength * 4) > currentLength)
33 {
34 _callouts.emplace_back(new Callout(pel));
35 currentLength += _callouts.back()->flattenedSize();
36 }
37}
38
Matt Spinler724d0d82019-11-06 10:05:36 -060039void Callouts::flatten(Stream& pel) const
Matt Spinler32f13c92019-10-09 12:48:25 -050040{
41 pel << _subsectionID << _subsectionFlags << _subsectionWordLength;
42
43 for (auto& callout : _callouts)
44 {
45 callout->flatten(pel);
46 }
47}
48
49} // namespace src
50} // namespace pels
51} // namespace openpower