
URL: https://svn.lrde.epita.fr/svn/oln/trunk/milena ChangeLog: 2007-09-17 Matthieu Garrigues <garrigues@lrde.epita.fr> add some comments * mln/io/internal/pnm/load.hh: . * mln/io/internal/pnm/save.hh: . --- load.hh | 8 +++++--- save.hh | 12 +++++++----- 2 files changed, 12 insertions(+), 8 deletions(-) Index: trunk/milena/mln/io/internal/pnm/save.hh =================================================================== --- trunk/milena/mln/io/internal/pnm/save.hh (revision 1114) +++ trunk/milena/mln/io/internal/pnm/save.hh (revision 1115) @@ -62,7 +62,7 @@ # ifndef MLN_INCLUDE_ONLY - // write a value into a file whatever the compiler + // write a rgb value into for uncontiguous datas template <unsigned int n> void write_value(std::ofstream& file, const value::rgb<n>& c) @@ -77,6 +77,7 @@ file.write((char*)&v, sizeof(E)); } + // write a scalar value into for uncontiguous datas template <typename V> void write_value(std::ofstream& file, V& v) @@ -87,10 +88,10 @@ file.write((char*)(&c), sizeof(E)); } - // save data for g++-2.95 and non fast images + // save data for (sizeof(int_u8) != 1) and non fast images template <typename I> void save_data_uncontiguous(std::ofstream& file, - const Fast_Image< I >& ima_) + const Image< I >& ima_) { const I& ima = exact(ima_); @@ -106,7 +107,8 @@ write_value(file, ima(p)); } - // save data for g++ > 2.95 with fast images + // save data when (sizeof(int_u8) == 1) with fast images + // (faster) template <typename I> void save_data_contiguous(std::ofstream& file, const Fast_Image<I>& ima_) @@ -123,7 +125,7 @@ } - // caller for non fast images + // caller for fast images template <typename I> void save_data(std::ofstream& file, const Fast_Image<I>& ima) Index: trunk/milena/mln/io/internal/pnm/load.hh =================================================================== --- trunk/milena/mln/io/internal/pnm/load.hh (revision 1114) +++ trunk/milena/mln/io/internal/pnm/load.hh (revision 1115) @@ -59,7 +59,7 @@ { # ifndef MLN_INCLUDE_ONLY - + //read a rgb value (sizeof(int_u8) != 1) template <unsigned int n> void read_value(std::ifstream& file, value::rgb<n>& v) @@ -75,6 +75,7 @@ v.blue() = c; } + //read a scalar value (sizeof(int_u8) != 1) template <class V> void read_value(std::ifstream& file, V& v) @@ -86,7 +87,7 @@ v = c; } - // used in g++-2.95 (sizeof(int_u8) == 2) + // used when (sizeof(int_u8) != 1) template <typename V> void load_raw_2d_uncontiguous(std::ifstream& file, image2d_b<V>& ima) @@ -103,6 +104,7 @@ read_value(file, ima(p)); } + // used in g++ > 2.95 template <typename I> void load_raw_2d_contiguous(std::ifstream& file, I& ima) { @@ -143,7 +145,7 @@ load_raw_2d_uncontiguous(file, ima); } - /// load pnm format + /// main function : load pnm format template <typename V> image2d_b<V> load(char type_, const std::string& filename) {
participants (1)
-
Matthieu Garrigues