core/vnl/vnl_file_vector.txx
Go to the documentation of this file.
00001 // This is core/vnl/vnl_file_vector.txx
00002 #ifndef vnl_file_vector_txx_
00003 #define vnl_file_vector_txx_
00004 //:
00005 // \file
00006 
00007 #include "vnl_file_vector.h"
00008 
00009 #include <vcl_fstream.h>
00010 #include <vcl_cstring.h> // for strcmp()
00011 
00012 //: Load vector from filename.
00013 template <class T>
00014 vnl_file_vector<T>::vnl_file_vector(char const* filename)
00015   : vnl_vector<T>() // makes an empty vector.
00016 {
00017 #ifdef DEBUG
00018   vcl_cerr << "filename=" << filename << "\nsize=" << this->size() << '\n';
00019 #endif
00020   if (filename && vcl_strcmp(filename, "-")) {
00021     vcl_ifstream o(filename);
00022     ok_ = this->read_ascii(o);
00023   }
00024   else
00025     ok_ = this->read_ascii(vcl_cin);
00026 #ifdef DEBUG
00027     vcl_cerr << "size=" << this->size() << '\n';
00028 #endif
00029   if (!ok_)
00030     vcl_cerr << "vnl_file_vector: ERROR loading from " << filename << '\n';
00031 }
00032 
00033 //--------------------------------------------------------------------------------
00034 
00035 #undef VNL_FILE_VECTOR_INSTANTIATE
00036 #define VNL_FILE_VECTOR_INSTANTIATE(T) template class vnl_file_vector<T >
00037 
00038 #endif // vnl_file_vector_txx_