| 150 | |
| 151 | template <class T> |
| 152 | void Serializer::_serialize(const T &obj) |
| 153 | { |
| 154 | // This should really be used to avoid simply copying complex objects that are not trivially copyable |
| 155 | // std::is_trivially_copyable is shipped with GCC 5 |
| 156 | // static_assert(std::is_trivially_copyable<T>::value, "Missing Serializer::_serialize overload for T = "/* __PRETTY_FUNCTION__*/); |
| 157 | |
| 158 | // Get a uint8_t pointer to the object, so we can copy it into the stream |
| 159 | auto objPtr = reinterpret_cast<const uint8_t *>(&obj); |
| 160 | |
| 161 | std::copy(objPtr, objPtr + sizeof(T), write); |
| 162 | |
| 163 | write += sizeof(T); |
| 164 | } |
| 165 | |
| 166 | template <class T> |
| 167 | void Serializer::deserialize(T &obj) |
nothing calls this directly
no outgoing calls
no test coverage detected