MCPcopy Create free account
hub / github.com/davisking/dlib / deserialize

Function deserialize

dlib/array2d/serialize_pixel_overloads.h:55–89  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

53 typename mem_manager
54 >
55 void deserialize (
56 array2d<rgb_pixel,mem_manager>& item,
57 std::istream& in
58 )
59 {
60 try
61 {
62 COMPILE_TIME_ASSERT(sizeof(rgb_pixel) == 3);
63
64 long nr, nc;
65 deserialize(nr,in);
66 deserialize(nc,in);
67
68 // this is the newer serialization format
69 if (nr < 0 || nc < 0)
70 {
71 nr *= -1;
72 nc *= -1;
73 }
74 else
75 {
76 std::swap(nr,nc);
77 }
78
79 item.set_size(nr,nc);
80
81 if (item.size() != 0)
82 in.read((char*)&item[0][0], sizeof(rgb_pixel)*item.size());
83 }
84 catch (serialization_error& e)
85 {
86 item.clear();
87 throw serialization_error(e.info + "\n while deserializing object of type array2d");
88 }
89 }
90
91// ----------------------------------------------------------------------------------------
92

Callers

nothing calls this directly

Calls 6

serialization_errorClass · 0.85
swapFunction · 0.70
set_sizeMethod · 0.45
sizeMethod · 0.45
readMethod · 0.45
clearMethod · 0.45

Tested by

no test coverage detected