PPL  0.12.1
Interval_Info.inlines.hh
Go to the documentation of this file.
00001 /* Interval_Info class implementation: inline functions.
00002    Copyright (C) 2001-2010 Roberto Bagnara <bagnara@cs.unipr.it>
00003    Copyright (C) 2010-2012 BUGSENG srl (http://bugseng.com)
00004 
00005 This file is part of the Parma Polyhedra Library (PPL).
00006 
00007 The PPL is free software; you can redistribute it and/or modify it
00008 under the terms of the GNU General Public License as published by the
00009 Free Software Foundation; either version 3 of the License, or (at your
00010 option) any later version.
00011 
00012 The PPL is distributed in the hope that it will be useful, but WITHOUT
00013 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00014 FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
00015 for more details.
00016 
00017 You should have received a copy of the GNU General Public License
00018 along with this program; if not, write to the Free Software Foundation,
00019 Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1307, USA.
00020 
00021 For the most up-to-date information see the Parma Polyhedra Library
00022 site: http://bugseng.com/products/ppl/ . */
00023 
00024 #ifndef PPL_Interval_Info_inlines_hh
00025 #define PPL_Interval_Info_inlines_hh 1
00026 
00027 #include <iomanip>
00028 
00029 namespace Parma_Polyhedra_Library {
00030 
00031 template <typename Policy>
00032 inline void
00033 Interval_Info_Null<Policy>::m_swap(Interval_Info_Null<Policy>&) {
00034 }
00035 
00036 template <typename Policy>
00037 inline void
00038 Interval_Info_Null<Policy>::ascii_dump(std::ostream&) const {
00039 }
00040 
00041 template <typename Policy>
00042 inline bool
00043 Interval_Info_Null<Policy>::ascii_load(std::istream&) {
00044   return true;
00045 }
00046 
00047 template <typename Policy>
00048 inline void
00049 Interval_Info_Null_Open<Policy>::ascii_dump(std::ostream& s) const {
00050   s << (open ? "open" : "closed");
00051 }
00052 
00053 template <typename Policy>
00054 inline bool
00055 Interval_Info_Null_Open<Policy>::ascii_load(std::istream& s) {
00056   std::string str;
00057   if (!(s >> str))
00058     return false;
00059   if (str == "open") {
00060     open = true;
00061     return true;
00062   }
00063   if (str == "closed") {
00064     open = false;
00065     return true;
00066   }
00067   return false;
00068 }
00069 
00070 template <typename T, typename Policy>
00071 inline void
00072 Interval_Info_Bitset<T, Policy>::m_swap(Interval_Info_Bitset<T, Policy>& y) {
00073   using std::swap;
00074   swap(bitset, y.bitset);
00075 }
00076 
00077 template <typename T, typename Policy>
00078 inline void
00079 Interval_Info_Bitset<T, Policy>::ascii_dump(std::ostream& s) const {
00080   const std::ios::fmtflags old_flags = s.setf(std::ios::hex,
00081                                               std::ios::basefield);
00082   s << bitset;
00083   s.flags(old_flags);
00084 }
00085 
00086 template <typename T, typename Policy>
00087 inline bool
00088 Interval_Info_Bitset<T, Policy>::ascii_load(std::istream& s) {
00089   const std::ios::fmtflags old_flags = s.setf(std::ios::hex,
00090                                               std::ios::basefield);
00091   s >> bitset;
00092   s.flags(old_flags);
00093   return !s.fail();
00094 }
00095 
00096 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
00097 
00098 #endif // defined(PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS)
00099 template <typename Policy>
00100 inline void
00101 swap(Interval_Info_Null<Policy>& x, Interval_Info_Null<Policy>& y) {
00102   x.m_swap(y);
00103 }
00104 
00105 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
00106 
00107 #endif // defined(PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS)
00108 template <typename T, typename Policy>
00109 inline void
00110 swap(Interval_Info_Bitset<T, Policy>& x, Interval_Info_Bitset<T, Policy>& y) {
00111   x.m_swap(y);
00112 }
00113 
00114 } // namespace Parma_Polyhedra_Library
00115 
00116 #endif // !defined(PPL_Interval_Info_inlines_hh)