
Index: ChangeLog from Nicolas Ballas <ballas@lrde.epita.fr> rle_class based on std::vector. * tests/core/rle_image.cc: add tests. * oln/core/rle/rle_image.hh, oln/core/rle/rle_psite.hh, oln/core/rle/rle_pset.hh, * oln/core/sparse/sparse_image.hh: Clean code. * oln/core/gen/rle_pset.hh, oln/core/gen/rle_image.hh, * oln/core/gen/rle_psite : New, add rle_image class which is based on a std::vector * oln/core/encode/rle_encode.hh: Rename. * oln/core/gen/rle_encode.hh: ... this. oln/core/gen/rle_encode.hh | 2 oln/core/gen/rle_image.hh | 160 ++++++++++++ oln/core/gen/rle_pset.hh | 496 ++++++++++++++++++++++++++++++++++++++++ oln/core/gen/rle_psite.hh | 88 +++++++ oln/core/rle/rle_image.hh | 7 oln/core/rle/rle_pset.hh | 19 - oln/core/rle/rle_psite.hh | 9 oln/core/sparse/sparse_image.hh | 3 tests/core/rle_image.cc | 21 + 9 files changed, 769 insertions(+), 36 deletions(-) Index: tests/core/rle_image.cc --- tests/core/rle_image.cc (revision 946) +++ tests/core/rle_image.cc (working copy) @@ -1,10 +1,22 @@ #include <iostream> #include <oln/core/2d/image2d.hh> -#include <oln/core/rle/rle_psite.hh> -#include <oln/core/rle/rle_image.hh> +#include <oln/core/gen/rle_psite.hh> +#include <oln/core/gen/rle_image.hh> #include <oln/debug/print.hh> -#include <oln/core/rle/rle_pset.hh> -#include <oln/core/encode/rle_encode.hh> +#include <oln/core/gen/rle_pset.hh> +#include <oln/core/gen/rle_encode.hh> + +template <typename P> +void test(const oln::rle_pset<P>& my_set) +{ + typename oln::rle_pset<P>::piter run (my_set); + for (run.start(); run.is_valid(); run.next()) + ; + + typename oln::rle_pset<P>::bkd_piter run2 (my_set); + for (run2.start(); run2.is_valid(); run2.next()) + ; +} int main() @@ -16,6 +28,7 @@ my_set.insert(p, 5); my_set.insert(q, 8); + test(my_set); rle.insert(p, 5, 4); rle.insert(q, 8, 9); Index: oln/core/rle/rle_image.hh --- oln/core/rle/rle_image.hh (revision 946) +++ oln/core/rle/rle_image.hh (working copy) @@ -93,15 +93,12 @@ rle_image(); - /// pset impl_points() const : return image pset + const pset& impl_points() const; - /// bool impl_owns_(const psite& p) const : same has impl_has + bool impl_owns_(const psite& p) const; - /// void insert(const point& p, unsigned len, value val) : insert a new range on the image void insert(const point& p, unsigned len, value val); - /// rvalue impl_read(const psite& p) const : return value associated to psite (for reading) rvalue impl_read(const psite& p) const; - /// lvalue impl_read_write(const psite& p) : lvalue impl_read_write(const psite& p) (for writing) lvalue impl_read_write(const psite& p); }; Index: oln/core/rle/rle_psite.hh --- oln/core/rle/rle_psite.hh (revision 946) +++ oln/core/rle/rle_psite.hh (working copy) @@ -40,25 +40,20 @@ template <typename P, typename T> struct rle_image; /* - ** \class rle_piste + ** \class rle_psite ** \brief psite for rle image ** ** Note: P must be a point type */ template <typename P> - class rle_psite + struct rle_psite { - public: rle_psite(); - // to_point: convert the psite to corresponding point P to_point() const; - // operator P(): convert psite to the corresponding point operator P () const; - /// start of the range which contains the psite P start_; - /// index of the point in the range unsigned index_; }; Index: oln/core/rle/rle_pset.hh --- oln/core/rle/rle_pset.hh (revision 946) +++ oln/core/rle/rle_pset.hh (working copy) @@ -84,24 +84,18 @@ rle_pset(); - /// unsigned impl_npoints() const : return number of point in the point set unsigned impl_npoints() const; - /// const box& impl_bbox() const : return a box which includes all poin into the set const box& impl_bbox() const; - /// void insert(const P& p, unsigned len): insert a new range on the point set void insert(const P& p, unsigned len); - /// bool impl_has(const P& p) const : if p include in the set bool impl_has(const P& p) const; - /// const std_container& con() const : return the container of the point const std_container& con() const; unsigned range_len_(const P& range_len_) const; protected: /// number of point in the set unsigned npts; - /// container of the set + std_container con_; // FIXME: Add a &. - /// pset box fbbox_<point> fb_; }; @@ -215,16 +209,11 @@ rle_pset_fwd_piter_(const rle_pset<P>& con); - /// void impl_start(): set the iterator to the start of pset void impl_start(); - /// void impl_next(): go to next point void impl_next(); - /// void impl_invalidate(): invalidate iterator void impl_invalidate(); - /// void impl_valid(): is the iterator valid? bool impl_is_valid() const; - /// conversion method const rle_psite<P>& impl_to_psite() const; point impl_to_point() const; const point* impl_psite_adr() const; @@ -234,7 +223,6 @@ protected: const typename rle_pset<P>::std_container& con_; typename rle_pset<P>::std_container::const_iterator it_; - /// current point rle_psite<P> ps_; }; @@ -352,16 +340,11 @@ rle_pset_bkd_piter_(const rle_pset<P>& con); - /// void impl_start(): set the iterator to the start of pset void impl_start(); - /// void impl_next(): go to next point void impl_next(); - /// void impl_invalidate(): invalidate iterator void impl_invalidate(); - /// void impl_valid(): is the iterator valid? bool impl_is_valid() const; - /// conversion methods const rle_psite<P>& impl_to_psite() const; point impl_to_point() const; const point* impl_psite_adr() const; Index: oln/core/gen/rle_pset.hh --- oln/core/gen/rle_pset.hh (revision 0) +++ oln/core/gen/rle_pset.hh (revision 0) @@ -0,0 +1,496 @@ +// Copyright (C) 2007 EPITA Research and Development Laboratory +// +// This file is part of the Olena Library. This library is free +// software; you can redistribute it and/or modify it under the terms +// of the GNU General Public License version 2 as published by the +// Free Software Foundation. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this library; see the file COPYING. If not, write to +// the Free Software Foundation, 51 Franklin Street, Fifth Floor, +// Boston, MA 02111-1307, USA. +// +// As a special exception, you may use this file as part of a free +// software library without restriction. Specifically, if other files +// instantiate templates or use macros or inline functions from this +// file, or you compile this file and link it with other files to +// produce an executable, this file does not by itself cause the +// resulting executable to be covered by the GNU General Public +// License. This exception does not however invalidate any other +// reasons why the executable file might be covered by the GNU General +// Public License. + +#ifndef OLN_CORE_RLE_RLE_PSET_HH +# define OLN_CORE_RLE_RLE_PSET_HH + +# include <vector> +# include <utility> + +# include <oln/core/rle/rle_psite.hh> +# include <oln/core/internal/point_set_base.hh> +# include <oln/core/internal/iterator_on_points_base.hh> +# include <oln/core/gen/fbbox.hh> + + +namespace oln +{ + + // Forwards declaration + template <typename P> struct rle_pset; + template <typename P> struct rle_pset_fwd_piter_; + template <typename P> struct rle_pset_bkd_piter_; + + // Super type. + template <typename P> + struct super_trait_< rle_pset<P> > + { + typedef rle_pset<P> current; + typedef internal::point_set_base_<current> ret; + }; + + // Vtypes associated to rle_pset class + template <typename P> + struct vtypes< rle_pset<P> > + { + typedef P point; + + typedef typename oln::internal::f_point_to_box_< P >::ret box; + typedef rle_pset_fwd_piter_<P> fwd_piter; + typedef rle_pset_bkd_piter_<P> bkd_piter; + }; + + // rle_pset class + /* + ** \class rle_pset + ** \brief pset correspoding to the rle_image class + ** + ** Note: P must be a point type + */ + template <typename P> + class rle_pset : public internal::point_set_base_<rle_pset <P> > + { + typedef rle_pset<P> current; + typedef internal::point_set_base_<rle_pset<P> > super; + + public: + stc_using(point); + stc_using(box); + + typedef std::vector<std::pair<point, unsigned> > std_container; + + rle_pset(); + + unsigned impl_npoints() const; + const box& impl_bbox() const; + void insert(const P& p, unsigned len); + bool impl_has(const P& p) const; + const std_container& con() const; + + unsigned range_len_(const P& range_len_) const; + protected: + /// number of point in the set + unsigned npts; + + std_container con_; // FIXME: Add a &. + fbbox_<point> fb_; + }; + + +# ifndef OLN_INCLUDE_ONLY + + template <typename P> + rle_pset<P>::rle_pset() : npts(0) + { + } + + + template <typename P> + unsigned + rle_pset<P>::impl_npoints() const + { + return npts; + } + + template <typename P> + void + rle_pset<P>::insert(const P& p, unsigned len) + { + point pend; + typename std_container::value_type elt (p, len); + + this->con_.push_back(elt); + + //update bbox + fb_.take(p); + pend = p; + pend[0] += len - 1; + fb_.take(pend); + // update size + npts += len; + } + + template <typename P> + const typename rle_pset<P>::box& + rle_pset<P>::impl_bbox() const + { + return fb_.box(); + } + + template <typename P> + bool + rle_pset<P>::impl_has(const P& p) const + { + typename std_container::const_iterator irun; + + for (irun = this->con_.begin(); irun != this->con_.end(); ++irun) + { + if (irun->first == p) + return true; + } + return false; + } + + template <typename P> + const typename rle_pset<P>::std_container& + rle_pset<P>::con() const + { + return this->con_; + } + + template <typename P> + unsigned + rle_pset<P>::range_len_(const P& range_start) const + { + typename std_container::const_iterator irun; + + for (irun = this->con_.begin(); irun != this->con_.end(); ++irun) + { + if (irun->first == range_start) + return irun->second; + } + assert(irun != this->con_.end()); + return (irun->second); + } + +# endif // !OLN_INCLUDE_ONLY + + // end of rle_pset class + + // -------------------- iterators on classes deriving from internal::rle_pset<P> + + + // ------------------- base class for factorizing code + + // Forward declaration + template <typename Exact> + class rle_pset_piter_; + + template <typename Exact> + struct super_trait_< rle_pset_piter_<Exact> > + { + typedef rle_pset_piter_<Exact> current; + typedef internal::iterator_on_points_base_<Exact> ret; + }; + + + // Virtual types + template <typename Exact> + struct vtypes< rle_pset_piter_<Exact> > + { + }; + + // class rle_pset_iterator_ + /* + ** \class rle_pset_piter_ + ** \brief base iterator class for factorizing code + ** + */ + template <typename Exact> + class rle_pset_piter_ : public internal::iterator_on_points_base_< Exact > + { + typedef internal::iterator_on_points_base_< Exact > super; + typedef rle_pset_piter_<Exact> current; + public: + stc_using(point); + typedef rle_psite<point> psite; + + const rle_psite<point>& impl_to_psite() const; + point impl_to_point() const; + const rle_psite<point>* impl_psite_adr() const; + operator psite () const; + const point* impl_point_adr() const; //FIXME + + protected: + rle_pset_piter_(const rle_pset<point>& con); + + const typename rle_pset<point>::std_container& con_; + + point p_; + rle_psite<point> ps_; + }; + +# ifndef OLN_INCLUDE_ONLY + + template <typename Exact> + rle_pset_piter_<Exact>::rle_pset_piter_(const rle_pset<typename rle_pset_piter_<Exact>::point>& cont) : + con_(cont.con()) + { + } + + template <typename Exact> + const rle_psite<typename rle_pset_piter_<Exact>::point>& + rle_pset_piter_<Exact>::impl_to_psite() const + { + return ps_; + } + + template <typename Exact> + typename rle_pset_piter_<Exact>::point + rle_pset_piter_<Exact>::impl_to_point() const + { + return ps_; + } + + template <typename Exact> + rle_pset_piter_<Exact>::operator typename rle_pset_piter_<Exact>::psite () const + { + return this->impl_to_psite(); + } + + template <typename Exact> + const rle_psite<typename rle_pset_piter_<Exact>::point>* + rle_pset_piter_<Exact>::impl_psite_adr() const + { + return &ps_; + } + + template <typename Exact> + const typename rle_pset_piter_<Exact>::point* + rle_pset_piter_<Exact>::impl_point_adr() const + { + return &p_; + } + //end of class rle_pset_iterator_ + +# endif // ! OLN_INCLUDE_ONLY + + + ////////////////////////////////////////////////////////////////////////////////////////////// + + // Forward declaration + template <typename P> + class rle_pset_fwd_piter_; + + // Super type. + template <typename P> + struct super_trait_< rle_pset_fwd_piter_<P> > + { + typedef rle_pset_fwd_piter_<P> current; + typedef rle_pset_piter_<current> ret; + }; + + // Virtual types + template <typename P> + struct vtypes< rle_pset_fwd_piter_<P> > + { + typedef P point; + }; + + // class rle_pset_fwd_iterator_ + /* + ** \class rle_pset_fwd_piter_ + ** \brief foward iterator for rle_pset + ** + ** P must be a point type + */ + template <typename P> + class rle_pset_fwd_piter_ : public rle_pset_piter_<rle_pset_fwd_piter_<P> > + { + typedef rle_pset_piter_< rle_pset_fwd_piter_<P> > super; + typedef rle_pset_fwd_piter_<P> current; + public: + stc_using(point); + + rle_pset_fwd_piter_(const rle_pset<P>& con); + + void impl_start(); + void impl_next(); + void impl_invalidate(); + bool impl_is_valid() const; + + protected: + typename rle_pset<point>::std_container::const_iterator it_; + }; + +# ifndef OLN_INCLUDE_ONLY + + template <typename P> + rle_pset_fwd_piter_<P>::rle_pset_fwd_piter_(const rle_pset<P>& cont) : + super(cont) + { + this->it_ = this->con_.end(); + this->ps_.pset_pos_ = this->con_.size(); + } + + template <typename P> + void + rle_pset_fwd_piter_<P>::impl_start() + { + this->it_ = this->con_.begin(); // FIXME: Test if (this->it_ != this->con_.end())... + this->ps_.start_ = this->it_->first; + this->ps_.index_ = 0; + this->ps_.pset_pos_ = 0; + this->p_ = this->ps_.start_; + } + + template <typename P> + void + rle_pset_fwd_piter_<P>::impl_next() + { + precondition(this->is_valid()); + + ++this->ps_.index_; + + if (this->ps_.index_ >= this->it_->second) + { + ++this->it_; + ++this->ps_.pset_pos_; + this->ps_.start_ = this->it_->first; + this->ps_.index_ = 0; + } + this->p_ = this->ps_.start_; + this->p_[0] += this->ps_.index_; + } + + template <typename P> + void + rle_pset_fwd_piter_<P>::impl_invalidate() + { + this->it_ = this->con_.end(); + this->ps_.pset_pos_ = this->con_.size(); + } + + template <typename P> + bool + rle_pset_fwd_piter_<P>::impl_is_valid() const + { + return this->it_ != this->con_.end(); + } +# endif // ! OLN_INCLUDE_ONLY + + //end of class rle_pset_fwd_iterator_ + + //////////////////////////////////////////////////////////////////////////////////////////////////// + // Forward declaration + template <typename P> + class rle_pset_bkd_piter_; + + // Super type. + template <typename P> + struct super_trait_< rle_pset_bkd_piter_<P> > + { + typedef rle_pset_bkd_piter_<P> current; + typedef rle_pset_piter_<current> ret; + }; + + // Virtual type + template <typename P> + struct vtypes< rle_pset_bkd_piter_<P> > + { + typedef P point; + }; + + /* + ** \class rle_pset_bkd_piter_ + ** \brief backward iterator for rle_pset + ** + ** P must be a point type + */ + template <typename P> + class rle_pset_bkd_piter_ : public rle_pset_piter_<rle_pset_bkd_piter_<P> > + { + typedef rle_pset_piter_< rle_pset_bkd_piter_<P> > super; + typedef rle_pset_bkd_piter_<P> current; + public: + stc_using(point); + + rle_pset_bkd_piter_(const rle_pset<P>& con); + + void impl_start(); + void impl_next(); + void impl_invalidate(); + bool impl_is_valid() const; + + protected: + typename rle_pset<point>::std_container::const_reverse_iterator it_; + }; + +# ifndef OLN_INCLUDE_ONLY + + template <typename P> + rle_pset_bkd_piter_<P>::rle_pset_bkd_piter_(const rle_pset<P>& cont) : + super(cont) + { + this->it_ = this->con_.rend(); + this->ps_.pset_pos_ = this->con_.size(); + } + + template <typename P> + void + rle_pset_bkd_piter_<P>::impl_start() + { + this->it_ = this->con_.rbegin(); // FIXME: Test if (this->it_ != this->con_.rend())... + this->ps_.start_ = this->it_->first; + this->ps_.index_ = this->it_->second - 1; + this->ps_.pset_pos_ = this->con_.size() - 1; + this->p_ = this->ps_.start_; + this->p_[0] += this->ps_.index_; + } + + template <typename P> + void + rle_pset_bkd_piter_<P>::impl_next() + { + precondition(this->is_valid()); + + --(this->ps_.index_); + + if (this->ps_.index_ + 1 == 0) + { + ++this->it_; + --this->ps_.pset_pos_; + this->ps_.start_ = this->it_->first; + this->ps_.index_ = this->it_->second - 1; + } + this->p_ = this->ps_.start_; + this->p_[0] += this->ps_.index_; + } + + template <typename P> + void + rle_pset_bkd_piter_<P>::impl_invalidate() + { + this->it_ = this->con_.rend(); + this->ps_.pset_pos_ = this->con_.size(); + } + + template <typename P> + bool + rle_pset_bkd_piter_<P>::impl_is_valid() const + { + return this->it_ != this->con_.rend(); + } +# endif // ! OLN_INCLUDE_ONLY + + // end of class rle_pset_bkd_piter_ + + +} // end of namespace oln + + +#endif // ! OLN_CORE_RLE_RLE_PSET_HH Index: oln/core/gen/rle_image.hh --- oln/core/gen/rle_image.hh (revision 0) +++ oln/core/gen/rle_image.hh (revision 0) @@ -0,0 +1,160 @@ +// Copyright (C) 2007 EPITA Research and Development Laboratory +// +// This file is part of the Olena Library. This library is free +// software; you can redistribute it and/or modify it under the terms +// of the GNU General Public License version 2 as published by the +// Free Software Foundation. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this library; see the file COPYING. If not, write to +// the Free Software Foundation, 51 Franklin Street, Fifth Floor, +// Boston, MA 02111-1307, USA. +// +// As a special exception, you may use this file as part of a free +// software library without restriction. Specifically, if other files +// instantiate templates or use macros or inline functions from this +// file, or you compile this file and link it with other files to +// produce an executable, this file does not by itself cause the +// resulting executable to be covered by the GNU General Public +// License. This exception does not however invalidate any other +// reasons why the executable file might be covered by the GNU General +// Public License. + +#ifndef OLN_CORE_GEN_RLE_IMAGE_HH +# define OLN_CORE_GEN_RLE_IMAGE_HH + +# include <vector> + +# include <oln/core/internal/image_base.hh> +# include <oln/core/gen/rle_psite.hh> +# include <oln/core/gen/rle_pset.hh> + + + +namespace oln +{ + // Fwd decl. + template <typename P, typename T> + struct rle_image; + + // Super type. + template <typename P, typename T> + struct super_trait_< rle_image<P, T> > + { + typedef rle_image<P, T> current; + typedef internal::primitive_image_<current> ret; + }; + + // Virtual types + template <typename P, typename T> + struct vtypes< rle_image<P, T> > + { + typedef T value; + typedef const T& rvalue; + typedef T& lvalue; + + typedef P point; + typedef typename P::coord coord; + + typedef rle_psite<P> psite; + + typedef rle_pset<point> pset; + + typedef mlc::none plain; + + typedef std::pair< pset, std::vector< value > > data; + }; + + + /* + ** \class rle_image + ** \brief rle image (use a pair of point range and value as representation) + ** + */ + template < typename P, typename T> + class rle_image : public internal::primitive_image_< rle_image<P, T> > + { + typedef rle_image<P, T> current; + typedef internal::primitive_image_< rle_image<P, T> > super; + public: + stc_using(pset); + stc_using(box); + stc_using(point); + stc_using(value); + stc_using(rvalue); + stc_using(lvalue); + stc_using(psite); + stc_using(data); + + rle_image(); + + + const pset& impl_points() const; + + bool impl_owns_(const psite& p) const; + void insert(const point& p, unsigned len, value val); + rvalue impl_read(const psite& p) const; + lvalue impl_read_write(const psite& p); + + }; + +# ifndef OLN_INCLUDE_ONLY + + template <typename P, typename T> + rle_image<P, T>::rle_image() + { + this->data_ = new data; + } + + template <typename P, typename T> + const typename rle_image<P, T>::pset& + rle_image<P, T>::impl_points() const + { + assert(this->has_data()); + return this->data_->first; + } + + template <typename P, typename T> + bool + rle_image<P, T>::impl_owns_(const typename rle_image<P, T>::psite& p) const + { + assert(this->has_data()); + return this->data_->first.has(p.start_); + } + + template <typename P, typename T> + void + rle_image<P, T>::insert(const typename rle_image<P, T>::point& p, + unsigned len, rle_image<P, T>::value val) + { + assert(this->has_data()); + this->data_->first.insert(p, len); + this->data_->second.push_back(val); + } + + template <typename P, typename T> + typename rle_image<P, T>::rvalue + rle_image<P, T>::impl_read(const rle_image<P, T>::psite& ps) const + { + assert(this->has_data() && ps.pset_pos_ < this->data_->second.size()); + return this->data_->second[ps.pset_pos_]; + } + + template <typename P, typename T> + typename rle_image<P, T>::lvalue + rle_image<P, T>::impl_read_write(const rle_image<P, T>::psite& ps) + { + assert(this->has_data() && ps.pset_pos_ < this->data_->second.size()); + return this->data_->second[ps.pset_pos_]; + } + +# endif // ! OLN_INCLUDE_ONLY + +} // end of namespace oln + +#endif // ! OLN_CORE_GEN_RLE_IMAGE_HH Index: oln/core/gen/rle_psite.hh --- oln/core/gen/rle_psite.hh (revision 0) +++ oln/core/gen/rle_psite.hh (revision 0) @@ -0,0 +1,88 @@ +// Copyright (C) 2007 EPITA Research and Development Laboratory +// +// This file is part of the Olena Library. This library is free +// software; you can redistribute it and/or modify it under the terms +// of the GNU General Public License version 2 as published by the +// Free Software Foundation. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this library; see the file COPYING. If not, write to +// the Free Software Foundation, 51 Franklin Street, Fifth Floor, +// Boston, MA 02111-1307, USA. +// +// As a special exception, you may use this file as part of a free +// software library without restriction. Specifically, if other files +// instantiate templates or use macros or inline functions from this +// file, or you compile this file and link it with other files to +// produce an executable, this file does not by itself cause the +// resulting executable to be covered by the GNU General Public +// License. This exception does not however invalidate any other +// reasons why the executable file might be covered by the GNU General +// Public License. + +#ifndef OLN_CORE_RLE_RLE_PSITE_HH +# define OLN_CORE_RLE_RLE_PSITE_HH + + +# include <map> +# include <utility> + +namespace oln +{ + + + // Forward declaration + template <typename P, typename T> struct rle_image; + + /* + ** \class rle_psite + ** \brief psite for rle image + ** + ** Note: P must be a point type + */ + template <typename P> + struct rle_psite + { + rle_psite(); + + P to_point() const; + operator P () const; + + P start_; + unsigned index_; + unsigned pset_pos_; + }; + +# ifndef OLN_INCLUDE_ONLY + + template <typename P> + rle_psite<P>::rle_psite() + { + } + + template <typename P> + P + rle_psite<P>::to_point() const + { + P p = this->start_; + + p[0] += this->index_; + return p; + } + + template <typename P> + rle_psite<P>::operator P() const + { + return this->to_point(); + } + +# endif /* !OLN_INCLUDE_ONLY */ + + //end of class rle_psite +} +#endif // !OLN_CORE_RLE_RLE_PSITE_HH Index: oln/core/gen/rle_encode.hh --- oln/core/gen/rle_encode.hh (revision 946) +++ oln/core/gen/rle_encode.hh (working copy) @@ -31,7 +31,7 @@ # include <oln/core/concept/image.hh> -# include <oln/core/rle/rle_image.hh> +# include <oln/core/gen/rle_image.hh> namespace oln Index: oln/core/sparse/sparse_image.hh --- oln/core/sparse/sparse_image.hh (revision 946) +++ oln/core/sparse/sparse_image.hh (working copy) @@ -129,7 +129,8 @@ template <typename P, typename T> void - sparse_image<P, T>::insert(const point& p, unsigned len, const std::vector<typename sparse_image<P, T>::value>& val) + sparse_image<P, T>::insert(const point& p, unsigned len, + const std::vector<typename sparse_image<P, T>::value>& val) { assert(this->has_data()); this->data_->first.insert(p, len);