/* Powerset class implementation: inline functions. Copyright (C) 2001-2010 Roberto Bagnara Copyright (C) 2010-2011 BUGSENG srl (http://bugseng.com) This file is part of the Parma Polyhedra Library (PPL). The PPL is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. The PPL 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 program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1307, USA. For the most up-to-date information see the Parma Polyhedra Library site: http://www.cs.unipr.it/ppl/ . */ #ifndef PPL_Powerset_inlines_hh #define PPL_Powerset_inlines_hh 1 #include #include "assert.hh" namespace Parma_Polyhedra_Library { template inline typename Powerset::iterator Powerset::begin() { return sequence.begin(); } template inline typename Powerset::iterator Powerset::end() { return sequence.end(); } template inline typename Powerset::const_iterator Powerset::begin() const { return sequence.begin(); } template inline typename Powerset::const_iterator Powerset::end() const { return sequence.end(); } template inline typename Powerset::reverse_iterator Powerset::rbegin() { return reverse_iterator(end()); } template inline typename Powerset::reverse_iterator Powerset::rend() { return reverse_iterator(begin()); } template inline typename Powerset::const_reverse_iterator Powerset::rbegin() const { return const_reverse_iterator(end()); } template inline typename Powerset::const_reverse_iterator Powerset::rend() const { return const_reverse_iterator(begin()); } template inline typename Powerset::size_type Powerset::size() const { return sequence.size(); } template inline bool Powerset::empty() const { return sequence.empty(); } template inline typename Powerset::iterator Powerset::drop_disjunct(iterator position) { return sequence.erase(position.base); } template inline void Powerset::drop_disjuncts(iterator first, iterator last) { sequence.erase(first.base, last.base); } template inline void Powerset::clear() { sequence.clear(); } template inline Powerset::Powerset(const Powerset& y) : sequence(y.sequence), reduced(y.reduced) { } template inline Powerset& Powerset::operator=(const Powerset& y) { sequence = y.sequence; reduced = y.reduced; return *this; } template inline void Powerset::swap(Powerset& y) { std::swap(sequence, y.sequence); std::swap(reduced, y.reduced); } template inline Powerset::Powerset() : sequence(), reduced(true) { } template inline Powerset::Powerset(const D& d) : sequence(), reduced(false) { sequence.push_back(d); PPL_ASSERT_HEAVY(OK()); } template inline Powerset::~Powerset() { } template inline void Powerset::add_non_bottom_disjunct_preserve_reduction(const D& d) { // !d.is_bottom() is asserted by the callee. add_non_bottom_disjunct_preserve_reduction(d, begin(), end()); } template inline void Powerset::add_disjunct(const D& d) { sequence.push_back(d); reduced = false; } /*! \relates Powerset */ template inline bool operator!=(const Powerset& x, const Powerset& y) { return !(x == y); } template inline bool Powerset::is_top() const { // Must perform omega-reduction for correctness. omega_reduce(); const_iterator xi = begin(); const_iterator x_end = end(); return xi != x_end && xi->is_top() && ++xi == x_end; } template inline bool Powerset::is_bottom() const { // Must perform omega-reduction for correctness. omega_reduce(); return empty(); } template inline void Powerset::collapse() { if (!empty()) collapse(sequence.begin()); } template inline void Powerset::meet_assign(const Powerset& y) { pairwise_apply_assign(y, std::mem_fun_ref(&D::meet_assign)); } template inline void Powerset::upper_bound_assign(const Powerset& y) { least_upper_bound_assign(y); } template inline bool Powerset::upper_bound_assign_if_exact(const Powerset& y) { least_upper_bound_assign(y); return true; } template inline memory_size_type Powerset::total_memory_in_bytes() const { return sizeof(*this) + external_memory_in_bytes(); } } // namespace Parma_Polyhedra_Library namespace std { /*! \relates Parma_Polyhedra_Library::Powerset */ template inline void swap(Parma_Polyhedra_Library::Powerset& x, Parma_Polyhedra_Library::Powerset& y) { x.swap(y); } } // namespace std #endif // !defined(PPL_Powerset_inlines_hh)