vnl_file_matrix.hxx
Go to the documentation of this file.
1 // This is core/vnl/vnl_file_matrix.hxx
2 #ifndef vnl_file_matrix_hxx_
3 #define vnl_file_matrix_hxx_
4 //:
5 // \file
6 //
7 // \author Andrew W. Fitzgibbon, Oxford RRG
8 // \date 23 Dec 96
9 //
10 //-----------------------------------------------------------------------------
11 
12 #include <fstream>
13 #include <iostream>
14 #include "vnl_file_matrix.h"
15 #ifdef _MSC_VER
16 # include <vcl_msvc_warnings.h>
17 #endif
18 
19 //: Load matrix from filename.
20 template <class T>
21 vnl_file_matrix<T>::vnl_file_matrix(char const* filename)
22 {
23  if (filename && filename[0]=='-' && filename[1]=='\0')
24  ok_ = this->read_ascii(std::cin);
25  else {
26  std::ifstream o(filename);
27  ok_ = this->read_ascii(o);
28  }
29 
30  if (!ok_)
31  std::cerr << "vnl_file_matrix: ERROR loading " << filename << '\n';
32 }
33 
34 //--------------------------------------------------------------------------------
35 
36 #undef VNL_FILE_MATRIX_INSTANTIATE
37 #define VNL_FILE_MATRIX_INSTANTIATE(T) \
38 template class VNL_EXPORT vnl_file_matrix<T >
39 
40 #endif // vnl_file_matrix_hxx_
vnl_file_matrix(char const *filename)
Load matrix from filename.
Load vnl_matrix<double> from file.