00001
00002 #ifndef vsl_block_binary_io_h_
00003 #define vsl_block_binary_io_h_
00004
00005
00006
00007
00008
00009 #include <vsl/vsl_binary_io.h>
00010 #include <vsl/vsl_binary_explicit_io.h>
00011
00012
00013 void vsl_block_binary_read_confirm_specialisation(vsl_b_istream &is, bool specialised);
00014
00015
00016 template <class T>
00017 inline void vsl_block_binary_write(vsl_b_ostream &os, const T* begin, vcl_size_t nelems);
00018
00019
00020 template <class T>
00021 inline void vsl_block_binary_read(vsl_b_istream &is, T* begin, vcl_size_t nelems);
00022
00023
00024
00025
00026
00027 template <class T>
00028 void vsl_block_binary_write_float_impl(vsl_b_ostream &os, const T* begin, vcl_size_t nelems);
00029
00030
00031 template <class T>
00032 void vsl_block_binary_read_float_impl(vsl_b_istream &is, T* begin, vcl_size_t nelems);
00033
00034
00035
00036
00037
00038
00039
00040 VCL_DEFINE_SPECIALIZATION
00041 inline void vsl_block_binary_write(vsl_b_ostream &os, const double* begin, vcl_size_t nelems)
00042 {
00043 vsl_block_binary_write_float_impl(os, begin, nelems);
00044 }
00045
00046
00047
00048 VCL_DEFINE_SPECIALIZATION
00049 inline void vsl_block_binary_read(vsl_b_istream &is, double* begin, vcl_size_t nelems)
00050 {
00051 vsl_block_binary_read_float_impl(is, begin, nelems);
00052 }
00053
00054
00055
00056
00057
00058
00059
00060 VCL_DEFINE_SPECIALIZATION
00061 inline void vsl_block_binary_write(vsl_b_ostream &os, const float* begin, vcl_size_t nelems)
00062 {
00063 vsl_block_binary_write_float_impl(os, begin, nelems);
00064 }
00065
00066
00067
00068 VCL_DEFINE_SPECIALIZATION
00069 inline void vsl_block_binary_read(vsl_b_istream &is, float* begin, vcl_size_t nelems)
00070 {
00071 vsl_block_binary_read_float_impl(is, begin, nelems);
00072 }
00073
00074
00075
00076
00077 template <class T>
00078 void vsl_block_binary_write_int_impl(vsl_b_ostream &os, const T* begin, vcl_size_t nelems);
00079
00080
00081 template <class T>
00082 void vsl_block_binary_read_int_impl(vsl_b_istream &is, T* begin, vcl_size_t nelems);
00083
00084
00085
00086
00087
00088
00089
00090 VCL_DEFINE_SPECIALIZATION
00091 inline void vsl_block_binary_write(vsl_b_ostream &os, const int* begin, vcl_size_t nelems)
00092 {
00093 vsl_block_binary_write_int_impl(os, begin, nelems);
00094 }
00095
00096
00097
00098
00099
00100 VCL_DEFINE_SPECIALIZATION
00101 inline void vsl_block_binary_read(vsl_b_istream &is, int* begin, vcl_size_t nelems)
00102 {
00103 vsl_block_binary_read_int_impl(is, begin, nelems);
00104 }
00105
00106
00107
00108
00109
00110
00111
00112 VCL_DEFINE_SPECIALIZATION
00113 inline void vsl_block_binary_write(vsl_b_ostream &os, const unsigned int* begin, vcl_size_t nelems)
00114 {
00115 vsl_block_binary_write_int_impl(os, begin, nelems);
00116 }
00117
00118
00119
00120
00121
00122 VCL_DEFINE_SPECIALIZATION
00123 inline void vsl_block_binary_read(vsl_b_istream &is, unsigned int* begin, vcl_size_t nelems)
00124 {
00125 vsl_block_binary_read_int_impl(is, begin, nelems);
00126 }
00127
00128
00129
00130
00131
00132
00133
00134
00135 VCL_DEFINE_SPECIALIZATION
00136 inline void vsl_block_binary_write(vsl_b_ostream &os, const short* begin, vcl_size_t nelems)
00137 {
00138 vsl_block_binary_write_int_impl(os, begin, nelems);
00139 }
00140
00141
00142
00143
00144
00145 VCL_DEFINE_SPECIALIZATION
00146 inline void vsl_block_binary_read(vsl_b_istream &is, short* begin, vcl_size_t nelems)
00147 {
00148 vsl_block_binary_read_int_impl(is, begin, nelems);
00149 }
00150
00151
00152
00153
00154
00155
00156
00157
00158 VCL_DEFINE_SPECIALIZATION
00159 inline void vsl_block_binary_write(vsl_b_ostream &os, const unsigned short* begin, vcl_size_t nelems)
00160 {
00161 vsl_block_binary_write_int_impl(os, begin, nelems);
00162 }
00163
00164
00165
00166
00167
00168 VCL_DEFINE_SPECIALIZATION
00169 inline void vsl_block_binary_read(vsl_b_istream &is, unsigned short* begin, vcl_size_t nelems)
00170 {
00171 vsl_block_binary_read_int_impl(is, begin, nelems);
00172 }
00173
00174
00175
00176
00177
00178
00179
00180
00181 VCL_DEFINE_SPECIALIZATION
00182 inline void vsl_block_binary_write(vsl_b_ostream &os, const long* begin, vcl_size_t nelems)
00183 {
00184 vsl_block_binary_write_int_impl(os, begin, nelems);
00185 }
00186
00187
00188
00189
00190
00191 VCL_DEFINE_SPECIALIZATION
00192 inline void vsl_block_binary_read(vsl_b_istream &is, long* begin, vcl_size_t nelems)
00193 {
00194 vsl_block_binary_read_int_impl(is, begin, nelems);
00195 }
00196
00197
00198
00199
00200
00201
00202
00203
00204 VCL_DEFINE_SPECIALIZATION
00205 inline void vsl_block_binary_write(vsl_b_ostream &os, const unsigned long* begin, vcl_size_t nelems)
00206 {
00207 vsl_block_binary_write_int_impl(os, begin, nelems);
00208 }
00209
00210
00211
00212
00213
00214 VCL_DEFINE_SPECIALIZATION
00215 inline void vsl_block_binary_read(vsl_b_istream &is, unsigned long* begin, vcl_size_t nelems)
00216 {
00217 vsl_block_binary_read_int_impl(is, begin, nelems);
00218 }
00219
00220
00221
00222
00223 template <class T>
00224 void vsl_block_binary_write_byte_impl(vsl_b_ostream &os, const T* begin, vcl_size_t nelems);
00225
00226
00227 template <class T>
00228 void vsl_block_binary_read_byte_impl(vsl_b_istream &is, T* begin, vcl_size_t nelems);
00229
00230
00231
00232
00233
00234 VCL_DEFINE_SPECIALIZATION
00235 inline void vsl_block_binary_write(vsl_b_ostream &os, const unsigned char* begin, vcl_size_t nelems)
00236 {
00237 vsl_block_binary_write_byte_impl(os, begin, nelems);
00238 }
00239
00240
00241
00242 VCL_DEFINE_SPECIALIZATION
00243 inline void vsl_block_binary_read(vsl_b_istream &is, unsigned char* begin, vcl_size_t nelems)
00244 {
00245 vsl_block_binary_read_byte_impl(is, begin, nelems);
00246 }
00247
00248
00249
00250
00251
00252 VCL_DEFINE_SPECIALIZATION
00253 inline void vsl_block_binary_write(vsl_b_ostream &os, const signed char* begin, vcl_size_t nelems)
00254 {
00255 vsl_block_binary_write_byte_impl(os, begin, nelems);
00256 }
00257
00258
00259
00260 VCL_DEFINE_SPECIALIZATION
00261 inline void vsl_block_binary_read(vsl_b_istream &is, signed char* begin, vcl_size_t nelems)
00262 {
00263 vsl_block_binary_read_byte_impl(is, begin, nelems);
00264 }
00265
00266
00267
00268 #if 0
00269
00270
00271
00272
00273
00274
00275
00276 VCL_DEFINE_SPECIALIZATION
00277 inline void vsl_block_binary_write(vsl_b_ostream &os, const vcl_ptrdiff_t* begin, vcl_size_t nelems)
00278 {
00279 vsl_block_binary_write_int_impl(os, begin, nelems);
00280 }
00281
00282
00283
00284
00285
00286 VCL_DEFINE_SPECIALIZATION
00287 inline void vsl_block_binary_read(vsl_b_istream &is, vcl_ptrdiff_t* begin, vcl_size_t nelems)
00288 {
00289 vsl_block_binary_read_int_impl(is, begin, nelems);
00290 }
00291
00292
00293
00294
00295
00296
00297
00298
00299 VCL_DEFINE_SPECIALIZATION
00300 inline void vsl_block_binary_write(vsl_b_ostream &os, const vcl_size_t* begin, vcl_size_t nelems)
00301 {
00302 vsl_block_binary_write_int_impl(os, begin, nelems);
00303 }
00304
00305
00306
00307
00308
00309 VCL_DEFINE_SPECIALIZATION
00310 inline void vsl_block_binary_read(vsl_b_istream &is, vcl_size_t* begin, vcl_size_t nelems)
00311 {
00312 vsl_block_binary_read_int_impl(is, begin, nelems);
00313 }
00314
00315 #endif // 0
00316
00317
00318
00319
00320
00321 template <class T>
00322 inline void vsl_block_binary_write(vsl_b_ostream &os, const T* begin, vcl_size_t nelems)
00323 {
00324 vsl_b_write(os, false);
00325 while (nelems--)
00326 vsl_b_write(os, *(begin++));
00327 }
00328
00329
00330
00331
00332 template <class T>
00333 inline void vsl_block_binary_read(vsl_b_istream &is, T* begin, vcl_size_t nelems)
00334 {
00335 vsl_block_binary_read_confirm_specialisation(is, false);
00336 if (!is) return;
00337 while (nelems--)
00338 vsl_b_read(is, *(begin++));
00339 }
00340
00341 #endif // vsl_block_binary_io_h_