| 25 | typename mem_manager |
| 26 | > |
| 27 | void serialize ( |
| 28 | const array2d<rgb_pixel,mem_manager>& item, |
| 29 | std::ostream& out |
| 30 | ) |
| 31 | { |
| 32 | try |
| 33 | { |
| 34 | // The reason the serialization is a little funny is because we are trying to |
| 35 | // maintain backwards compatibility with an older serialization format used by |
| 36 | // dlib while also encoding things in a way that lets the array2d and matrix |
| 37 | // objects have compatible serialization formats. |
| 38 | serialize(-item.nr(),out); |
| 39 | serialize(-item.nc(),out); |
| 40 | |
| 41 | COMPILE_TIME_ASSERT(sizeof(rgb_pixel) == 3); |
| 42 | |
| 43 | if (item.size() != 0) |
| 44 | out.write((char*)&item[0][0], sizeof(rgb_pixel)*item.size()); |
| 45 | } |
| 46 | catch (serialization_error& e) |
| 47 | { |
| 48 | throw serialization_error(e.info + "\n while serializing object of type array2d"); |
| 49 | } |
| 50 | } |
| 51 | |
| 52 | template < |
| 53 | typename mem_manager |
nothing calls this directly
no test coverage detected