
URL: https://svn.lrde.epita.fr/svn/oln/trunk/milena ChangeLog: 2007-10-02 Guillaume Duhamel <guillaume.duhamel@lrde.epita.fr> Add empty in queue_p. Update. * queue_p.hh: Add empty. --- queue_p.hh | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) Index: trunk/milena/mln/core/queue_p.hh =================================================================== --- trunk/milena/mln/core/queue_p.hh (revision 1216) +++ trunk/milena/mln/core/queue_p.hh (revision 1217) @@ -79,12 +79,18 @@ /// Test is \p p belongs to this point set. bool has(const P& p) const; + /// Test if queue is empty or not. + bool empty() const; + /// Give the number of points. std::size_t npoints() const; /// Give the exact bounding box. const box_<P>& bbox() const; + /// Push force a point \p p in the queue. + queue_p<P>& push_force(const P& p); + /// Push a point \p p in the queue. queue_p<P>& push(const P& p); @@ -162,6 +168,13 @@ } template <typename P> + bool + queue_p<P>::empty() const + { + return (q_.empty()); + } + + template <typename P> std::size_t queue_p<P>::npoints() const { @@ -180,10 +193,8 @@ template <typename P> queue_p<P>& - queue_p<P>::push(const P& p) + queue_p<P>::push_force(const P& p) { - mln_precondition(! has(p)); - // FIXME: Our choice is "error if multiple insertions" q_.push_back(p); if (! vect_needs_update_) { @@ -194,6 +205,15 @@ } template <typename P> + queue_p<P>& + queue_p<P>::push(const P& p) + { + mln_precondition(! has(p)); + // FIXME: Our choice is "error if multiple insertions" + return this->push_force(p); + } + + template <typename P> void queue_p<P>::pop() {