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

Function serialize

dlib/graph/graph_kernel_1.h:342–374  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

340 bool is_checked
341 >
342 void serialize (
343 const graph_kernel_1<T,E,mem_manager,is_checked>& item,
344 std::ostream& out
345 )
346 {
347 try
348 {
349 serialize(item.number_of_nodes(), out);
350
351 // serialize each node
352 for (unsigned long i = 0; i < item.number_of_nodes(); ++i)
353 {
354 serialize(item.node(i).data, out);
355
356 // serialize all the edges
357 for (unsigned long n = 0; n < item.node(i).number_of_neighbors(); ++n)
358 {
359 // only serialize edges that we haven't already serialized
360 if (item.node(i).neighbor(n).index() >= i)
361 {
362 serialize(item.node(i).neighbor(n).index(), out);
363 serialize(item.node(i).edge(n), out);
364 }
365 }
366 const unsigned long stop_mark = 0xFFFFFFFF;
367 serialize(stop_mark, out);
368 }
369 }
370 catch (serialization_error& e)
371 {
372 throw serialization_error(e.info + "\n while serializing object of type graph_kernel_1");
373 }
374 }
375
376// ----------------------------------------------------------------------------------------
377

Callers

nothing calls this directly

Calls 5

serialization_errorClass · 0.85
neighborMethod · 0.80
number_of_nodesMethod · 0.45
number_of_neighborsMethod · 0.45
indexMethod · 0.45

Tested by

no test coverage detected