PPL  0.12.1
EList_Iterator.inlines.hh
Go to the documentation of this file.
00001 /* EList_Iterator 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_EList_Iterator_inlines_hh
00025 #define PPL_EList_Iterator_inlines_hh 1
00026 
00027 #include "Doubly_Linked_Object.defs.hh"
00028 
00029 namespace Parma_Polyhedra_Library {
00030 
00031 namespace Implementation {
00032 
00033 namespace Watchdog {
00034 
00035 template <typename T>
00036 inline
00037 EList_Iterator<T>::EList_Iterator() {
00038 }
00039 
00040 template <typename T>
00041 inline
00042 EList_Iterator<T>::EList_Iterator(Doubly_Linked_Object* p)
00043   : ptr(p) {
00044 }
00045 
00046 template <typename T>
00047 inline EList_Iterator<T>&
00048 EList_Iterator<T>::operator=(Doubly_Linked_Object* p) {
00049   ptr = p;
00050   return *this;
00051 }
00052 
00053 template <typename T>
00054 inline T*
00055 EList_Iterator<T>::operator->() {
00056   return static_cast<T*>(ptr);
00057 }
00058 
00059 template <typename T>
00060 inline T&
00061 EList_Iterator<T>::operator*() {
00062   return *operator->();
00063 }
00064 
00065 template <typename T>
00066 inline EList_Iterator<T>&
00067 EList_Iterator<T>::operator++() {
00068   ptr = ptr->next;
00069   return *this;
00070 }
00071 
00072 template <typename T>
00073 inline EList_Iterator<T>
00074 EList_Iterator<T>::operator++(int) {
00075   EList_Iterator tmp = *this;
00076   ++*this;
00077   return tmp;
00078 }
00079 
00080 template <typename T>
00081 inline EList_Iterator<T>&
00082 EList_Iterator<T>::operator--() {
00083   ptr = ptr->prev;
00084   return *this;
00085 }
00086 
00087 template <typename T>
00088 inline EList_Iterator<T>
00089 EList_Iterator<T>::operator--(int) {
00090   EList_Iterator tmp = *this;
00091   --*this;
00092   return tmp;
00093 }
00094 
00095 template <typename T>
00096 inline bool
00097 operator==(const EList_Iterator<T>& x, const EList_Iterator<T>& y) {
00098   return x.ptr == y.ptr;
00099 }
00100 
00101 template <typename T>
00102 inline bool
00103 operator!=(const EList_Iterator<T>& x, const EList_Iterator<T>& y) {
00104   return x.ptr != y.ptr;
00105 }
00106 
00107 } // namespace Watchdog
00108 
00109 } // namespace Implementation
00110 
00111 } // namespace Parma_Polyhedra_Library
00112 
00113 #endif // !defined(PPL_EList_Iterator_inlines_hh)