Matt Spinler | 5b3a11d | 2019-10-08 14:13:31 -0500 | [diff] [blame] | 1 | #include "pce_identity.hpp" |
| 2 | |
| 3 | namespace openpower |
| 4 | { |
| 5 | namespace pels |
| 6 | { |
| 7 | namespace src |
| 8 | { |
| 9 | |
| 10 | PCEIdentity::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 | |
| 26 | void PCEIdentity::flatten(Stream& pel) |
| 27 | { |
| 28 | pel << _type << _size << _flags << _mtms << _pceName; |
| 29 | } |
| 30 | |
| 31 | } // namespace src |
| 32 | } // namespace pels |
| 33 | } // namespace openpower |