blob: 12b21ae5ce748e5c75d4631e11aa2207e7d2e093 [file] [log] [blame]
Matt Spinler5b3a11d2019-10-08 14:13:31 -05001#include "pce_identity.hpp"
2
3namespace openpower
4{
5namespace pels
6{
7namespace src
8{
9
10PCEIdentity::PCEIdentity(Stream& pel)
11{
12 pel >> _type >> _size >> _flags >> _mtms;
13
14 // Whatever is left is the enclosure name.
15 if (_size < (4 + _mtms.flattenedSize()))
16 {
17 throw std::runtime_error("PCE identity structure size field too small");
18 }
19
20 size_t pceNameSize = _size - (4 + _mtms.flattenedSize());
21
22 _pceName.resize(pceNameSize);
23 pel >> _pceName;
24}
25
26void PCEIdentity::flatten(Stream& pel)
27{
28 pel << _type << _size << _flags << _mtms << _pceName;
29}
30
31} // namespace src
32} // namespace pels
33} // namespace openpower