2 #ifndef vil_io_smart_ptr_hxx_ 3 #define vil_io_smart_ptr_hxx_ 11 #include <vsl/vsl_binary_io.h> 20 constexpr
short io_version_no = 2;
23 if (p.
ptr() ==
nullptr)
32 unsigned long id = os.get_serial_number(p.
ptr());
37 id = os.add_serialisation_record(p.
ptr());
89 T * pointer = static_cast<T *>( is.get_serialisation_pointer(
id));
90 if (first_time != (pointer ==
nullptr))
95 std::cerr <<
"I/O ERROR: vsl_b_read(vsl_b_istream&, vil_smart_ptr<T>&)\n" 96 <<
" De-serialisation failure\n";
97 is.is().clear(std::ios::badbit);
101 if (pointer ==
nullptr)
107 is.add_serialisation_record(
id, pointer);
115 std::cerr <<
"I/O ERROR: vsl_b_read(vsl_b_istream&, vil_smart_ptr<T>&)\n" 116 <<
" Unknown version number "<< ver <<
'\n';
117 is.is().clear(std::ios::badbit);
127 os <<
"Smart ptr to ";
140 #if 0 // commented out 179 os <<
"vil_smart_ptr: ";
185 #undef VIL_IO_SMART_PTR_INSTANTIATE 186 #define VIL_IO_SMART_PTR_INSTANTIATE(T) \ 187 template void vsl_print_summary(std::ostream &, const vil_smart_ptr<T > &); \ 188 template void vsl_b_read(vsl_b_istream &, vil_smart_ptr<T > &); \ 189 template void vsl_b_write(vsl_b_ostream &, const vil_smart_ptr<T > &) 191 #endif // vil_io_smart_ptr_hxx_ A templated smart pointer class.
Serialised binary IO functions for vil_smart_ptr<T>
void vsl_print_summary(std::ostream &os, const vil_image_view< T > &image)
Print human readable summary of a vil_image_view<T> object to a stream.
void vsl_b_write(vsl_b_ostream &os, const vil_image_view< T > &image)
Binary save vil_image_view<T> to stream.
Contains a templated smart pointer class.
void vsl_b_read(vsl_b_istream &is, vil_image_view< T > &image)
Binary load vil_image_view<T> from stream.
T * ptr() const
These methods all return the raw/dumb pointer.