|
17 | 17 |
|
18 | 18 | namespace eos { |
19 | 19 |
|
20 | | - // this value is written to the top of the stream |
21 | | - const signed char magic_byte = 'e' | 'o' | 's'; |
| 20 | +// this value is written to the top of the stream |
| 21 | +const signed char magic_byte = 'e' | 'o' | 's'; |
22 | 22 |
|
23 | | - // flag for fp serialization |
24 | | - const unsigned no_infnan = 64; |
| 23 | +// flag for fp serialization |
| 24 | +const unsigned no_infnan = 64; |
25 | 25 |
|
26 | | - // integral type for the archive version |
27 | | - using archive_version_type = lslboost::archive::library_version_type; |
| 26 | +// integral type for the archive version |
| 27 | +using archive_version_type = lslboost::archive::library_version_type; |
28 | 28 |
|
29 | | - // version of the linked lslboost archive library |
30 | | - const archive_version_type archive_version( |
31 | | - lslboost::archive::BOOST_ARCHIVE_VERSION() |
32 | | - ); |
| 29 | +// version of the linked lslboost archive library |
| 30 | +const archive_version_type archive_version(lslboost::archive::BOOST_ARCHIVE_VERSION()); |
33 | 31 |
|
34 | | - /** |
35 | | - * \brief Exception being thrown when serialization cannot proceed. |
36 | | - * |
37 | | - * There are several situations in which the portable archives may fail and |
38 | | - * hence throw an exception: |
39 | | - * -# deserialization of an integer value that exceeds the range of the type |
40 | | - * -# (de)serialization of inf/nan through an archive with no_infnan flag set |
41 | | - * -# deserialization of a denormalized value without the floating point type |
42 | | - * supporting denormalized numbers |
43 | | - * |
44 | | - * Note that this exception will also be thrown if you mixed up your stream |
45 | | - * position and accidentially interpret some value for size data (in this case |
46 | | - * the reported size will be totally amiss most of the time). |
47 | | - */ |
48 | | - class portable_archive_exception : public lslboost::archive::archive_exception |
49 | | - { |
50 | | - std::string msg; |
| 32 | +/** |
| 33 | + * \brief Exception being thrown when serialization cannot proceed. |
| 34 | + * |
| 35 | + * There are several situations in which the portable archives may fail and |
| 36 | + * hence throw an exception: |
| 37 | + * -# deserialization of an integer value that exceeds the range of the type |
| 38 | + * -# (de)serialization of inf/nan through an archive with no_infnan flag set |
| 39 | + * -# deserialization of a denormalized value without the floating point type |
| 40 | + * supporting denormalized numbers |
| 41 | + * |
| 42 | + * Note that this exception will also be thrown if you mixed up your stream |
| 43 | + * position and accidentially interpret some value for size data (in this case |
| 44 | + * the reported size will be totally amiss most of the time). |
| 45 | + */ |
| 46 | +class portable_archive_exception : public lslboost::archive::archive_exception { |
| 47 | + std::string msg; |
51 | 48 |
|
52 | | - public: |
53 | | - //! type size is not large enough for deserialized number |
54 | | - portable_archive_exception(signed char invalid_size) |
55 | | - : lslboost::archive::archive_exception(other_exception) |
56 | | - , msg("requested integer size exceeds type size: ") |
57 | | - { |
58 | | - msg += std::to_string(invalid_size); |
59 | | - } |
| 49 | +public: |
| 50 | + //! type size is not large enough for deserialized number |
| 51 | + portable_archive_exception(signed char invalid_size) |
| 52 | + : lslboost::archive::archive_exception(other_exception), |
| 53 | + msg("requested integer size exceeds type size: ") { |
| 54 | + msg += std::to_string(invalid_size); |
| 55 | + } |
60 | 56 |
|
61 | | - //! negative number in unsigned type |
62 | | - portable_archive_exception() |
63 | | - : lslboost::archive::archive_exception(other_exception) |
64 | | - , msg("cannot read a negative number into an unsigned type") |
65 | | - { |
66 | | - } |
| 57 | + //! negative number in unsigned type |
| 58 | + portable_archive_exception() |
| 59 | + : lslboost::archive::archive_exception(other_exception), |
| 60 | + msg("cannot read a negative number into an unsigned type") {} |
67 | 61 |
|
68 | | - //! serialization of inf, nan and denormals |
69 | | - template <typename T> |
70 | | - portable_archive_exception(const T& abnormal) |
71 | | - : lslboost::archive::archive_exception(other_exception) |
72 | | - , msg("serialization of illegal floating point value: ") |
73 | | - { |
74 | | - msg += std::to_string(abnormal); |
75 | | - } |
| 62 | + //! serialization of inf, nan and denormals |
| 63 | + template <typename T> |
| 64 | + portable_archive_exception(const T &abnormal) |
| 65 | + : lslboost::archive::archive_exception(other_exception), |
| 66 | + msg("serialization of illegal floating point value: ") { |
| 67 | + msg += std::to_string(abnormal); |
| 68 | + } |
76 | 69 |
|
77 | | - //! override the base class function with our message |
78 | | - const char *what() const noexcept override { return msg.c_str(); } |
79 | | - ~portable_archive_exception() noexcept override = default; |
80 | | - }; |
| 70 | + //! override the base class function with our message |
| 71 | + const char *what() const noexcept override { return msg.c_str(); } |
| 72 | + ~portable_archive_exception() noexcept override = default; |
| 73 | +}; |
81 | 74 |
|
82 | 75 | } // namespace eos |
0 commit comments