2578: Add more services to mln::topo::n_faces_set.

* mln/topo/n_faces_set.hh (mln::topo::n_faces_set<N, D>::reserve) (operator+=(n_faces_set<N, D>&, const n_face<N, D>&)): New. --- milena/ChangeLog | 9 +++++++++ milena/mln/topo/n_faces_set.hh | 28 ++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+), 0 deletions(-) diff --git a/milena/ChangeLog b/milena/ChangeLog index 83ba017..4cd9a13 100644 --- a/milena/ChangeLog +++ b/milena/ChangeLog @@ -1,5 +1,14 @@ 2008-10-16 Roland Levillain <roland@lrde.epita.fr> + Add more services to mln::topo::n_faces_set. + + * mln/topo/n_faces_set.hh + (mln::topo::n_faces_set<N, D>::reserve) + (operator+=(n_faces_set<N, D>&, const n_face<N, D>&)): + New. + +2008-10-16 Roland Levillain <roland@lrde.epita.fr> + Add more services to mln::topo::n_face. * mln/topo/n_face.hh diff --git a/milena/mln/topo/n_faces_set.hh b/milena/mln/topo/n_faces_set.hh index 9b853ba..cf11eef 100644 --- a/milena/mln/topo/n_faces_set.hh +++ b/milena/mln/topo/n_faces_set.hh @@ -56,8 +56,16 @@ namespace mln class n_faces_set { public: + /// \brief Append face \a f to the set. void add(const n_face<N, D>& f); + /// \brief Reserve \a n cells in the set. + /// + /// This methods does not change the content of \a faces_; it + /// only pre-allocate memory. Method reserve is provided for + /// efficiency purpose, and its use is completely optional. + void reserve(size_t n); + /// \brief Accessors. /// /// Return the set of handles. @@ -82,6 +90,10 @@ namespace mln template <unsigned N, unsigned D> n_faces_set<N, D> operator+(const n_faces_set<N, D>& fs, const n_face<N, D>& f); + + template <unsigned N, unsigned D> + n_faces_set<N, D>& + operator+=(n_faces_set<N, D>& fs, const n_face<N, D>& f); /// \} @@ -101,6 +113,14 @@ namespace mln template <unsigned N, unsigned D> inline + void + n_faces_set<N, D>::reserve(size_t n) + { + faces_.reserve(n); + } + + template <unsigned N, unsigned D> + inline const std::vector< n_face<N, D> >& n_faces_set<N, D>::faces() const { @@ -129,6 +149,14 @@ namespace mln return fs2; } + template <unsigned N, unsigned D> + n_faces_set<N, D>& + operator+=(n_faces_set<N, D>& fs, const n_face<N, D>& f) + { + fs.add(f); + return fs; + } + # endif // ! MLN_INCLUDE_ONLY } // end of namespace mln::topo -- 1.6.0.1
participants (1)
-
Roland Levillain