Macros | Functions
vnl_matlab_read.cxx File Reference
#include <ios>
#include <iostream>
#include <complex>
#include <cstring>
#include "vnl_matlab_read.h"
#include <vnl/vnl_c_vector.h>
#include <vnl/vnl_vector.h>
#include <vnl/vnl_matrix.h>

Go to the source code of this file.

Macros

#define implement_read_complex_data(T)
 
#define fsm_define_methods(T)
 
#define inst(T)
 

Functions

template<class T >
void vcl_destroy (T *p)
 
template<class U , class V >
void vcl_construct (U *p, V const &value)
 
void vnl_read_bytes (std::istream &s, void *p, unsigned bytes)
 
template<>
void vnl_matlab_read_data (std::istream &s, float *p, unsigned n)
 
template<>
void vnl_matlab_read_data (std::istream &s, double *p, unsigned n)
 
 implement_read_complex_data (float) implement_read_complex_data(double) vnl_matlab_readhdr
 
 fsm_define_methods (float)
 
 fsm_define_methods (double)
 
 fsm_define_methods (std::complex< float >)
 
 fsm_define_methods (std::complex< double >)
 
template<class T >
bool vnl_matlab_read_or_die (std::istream &s, vnl_vector< T > &v, char const *name)
 Attempt to read vector or matrix. More...
 
template<class T >
bool vnl_matlab_read_or_die (std::istream &s, vnl_matrix< T > &M, char const *name)
 
 inst (double)
 
 inst (float)
 

Detailed Description

Author
fsm

Definition in file vnl_matlab_read.cxx.

Macro Definition Documentation

◆ fsm_define_methods

#define fsm_define_methods (   T)

Definition at line 179 of file vnl_matlab_read.cxx.

◆ implement_read_complex_data

#define implement_read_complex_data (   T)
Value:
template <> \
void vnl_matlab_read_data(std::istream &s, std::complex<T > *ptr, unsigned n) { \
::vnl_read_bytes(s, re, n*sizeof(T)); \
::vnl_read_bytes(s, im, n*sizeof(T)); \
for (unsigned i=0; i<n; ++i) \
ptr[i] = std::complex<T >(re[i], im[i]); \
}
static void deallocate(T **, const std::size_t n_when_allocated)
void vnl_read_bytes(std::istream &s, void *p, unsigned bytes)
static T * allocate_T(const std::size_t n)
void vnl_matlab_read_data(std::istream &s, float *p, unsigned n)

Definition at line 37 of file vnl_matlab_read.cxx.

◆ inst

#define inst (   T)
Value:
template VNL_EXPORT bool vnl_matlab_read_or_die(std::istream &, vnl_vector<T> &, char const *); \
template VNL_EXPORT bool vnl_matlab_read_or_die(std::istream &, vnl_matrix<T> &, char const *);
bool vnl_matlab_read_or_die(std::istream &s, vnl_vector< T > &v, char const *name)
Attempt to read vector or matrix.
An ordinary mathematical matrix.
Definition: vnl_adjugate.h:22
Mathematical vector class, templated by type of element.
Definition: vnl_fwd.h:16

Definition at line 282 of file vnl_matlab_read.cxx.

Function Documentation

◆ fsm_define_methods() [1/4]

fsm_define_methods ( float  )

◆ fsm_define_methods() [2/4]

fsm_define_methods ( double  )

◆ fsm_define_methods() [3/4]

fsm_define_methods ( std::complex< float >  )

◆ fsm_define_methods() [4/4]

fsm_define_methods ( std::complex< double >  )

◆ implement_read_complex_data()

implement_read_complex_data ( float  )

Definition at line 50 of file vnl_matlab_read.cxx.

◆ inst() [1/2]

inst ( double  )

◆ inst() [2/2]

inst ( float  )

◆ vcl_construct()

template<class U , class V >
void vcl_construct ( U *  p,
V const &  value 
)
inline

Definition at line 20 of file vnl_matlab_read.cxx.

◆ vcl_destroy()

template<class T >
void vcl_destroy ( T *  p)
inline

Definition at line 16 of file vnl_matlab_read.cxx.

◆ vnl_matlab_read_data() [1/2]

template<>
void vnl_matlab_read_data ( std::istream &  s,
float *  p,
unsigned  n 
)

Definition at line 30 of file vnl_matlab_read.cxx.

◆ vnl_matlab_read_data() [2/2]

template<>
void vnl_matlab_read_data ( std::istream &  s,
double *  p,
unsigned  n 
)

Definition at line 34 of file vnl_matlab_read.cxx.

◆ vnl_matlab_read_or_die() [1/2]

template<class T >
bool vnl_matlab_read_or_die ( std::istream &  ,
vnl_vector< T > &  ,
char const *  name = nullptr 
)

Attempt to read vector or matrix.

If the MATLAB header cannot be read, return false. Else, if a name is given, and it doesn't match what's in the file, abort(). If the data in the file cannot reasonably be read into the destination, abort().

The vector/matrix will be resized if necessary.

Definition at line 231 of file vnl_matlab_read.cxx.

◆ vnl_matlab_read_or_die() [2/2]

template<class T >
bool vnl_matlab_read_or_die ( std::istream &  s,
vnl_matrix< T > &  M,
char const *  name 
)

Definition at line 257 of file vnl_matlab_read.cxx.

◆ vnl_read_bytes()

void vnl_read_bytes ( std::istream &  s,
void *  p,
unsigned  bytes 
)

Definition at line 24 of file vnl_matlab_read.cxx.