00001 /* 00002 This file is part of the CVD Library. 00003 00004 Copyright (C) 2005 The Authors 00005 00006 This library is free software; you can redistribute it and/or 00007 modify it under the terms of the GNU Lesser General Public 00008 License as published by the Free Software Foundation; either 00009 version 2.1 of the License, or (at your option) any later version. 00010 00011 This library is distributed in the hope that it will be useful, 00012 but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00014 Lesser General Public License for more details. 00015 00016 You should have received a copy of the GNU Lesser General Public 00017 License along with this library; if not, write to the Free Software 00018 Foundation, Inc., 00019 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 00020 */ 00021 #ifndef CVD_INCLUDE_INTERNAL_IO_TEXT_H 00022 #define CVD_INCLUDE_INTERNAL_IO_TEXT_H 00023 00024 #include <iostream> 00025 #include <memory> 00026 #include <vector> 00027 #include <string> 00028 #include <cvd/image.h> 00029 #include <cvd/internal/load_and_save.h> 00030 00031 namespace CVD 00032 { 00033 namespace TEXT 00034 { 00035 00036 using CVD::Internal::TypeList; 00037 using CVD::Internal::Head; 00038 00039 class ReadPimpl; 00040 class reader 00041 { 00042 public: 00043 reader(std::istream&); 00044 ~reader(); 00045 00046 ImageRef size(); 00047 00048 void get_raw_pixel_line(double*); 00049 00050 std::string datatype(); 00051 std::string name(); 00052 00053 00054 typedef TypeList<double, Head> Types; 00055 00056 private: 00057 std::auto_ptr<ReadPimpl> t; 00058 }; 00059 00060 00062 // 00063 // TEXT writing 00064 // 00065 class WritePimpl; 00066 00067 class writer 00068 { 00069 public: 00070 writer(std::ostream&, ImageRef size, const std::string& type, const std::map<std::string, Parameter<> >& p); 00071 ~writer(); 00072 00073 void write_raw_pixel_line(const double*); 00074 void write_raw_pixel_line(const float*); 00075 00076 template<class Incoming> struct Outgoing 00077 { 00078 typedef double type; 00079 }; 00080 00081 private: 00082 std::auto_ptr<WritePimpl> t; 00083 }; 00084 00085 } 00086 } 00087 #endif