MC_int_pair.hpp

Go to the documentation of this file.
00001 /*
00002 **    Mesh Converter
00003 **    Copyright (C) 2009  Damien Rohmer
00004 **
00005 **    This program is free software: you can redistribute it and/or modify
00006 **    it under the terms of the GNU General Public License as published by
00007 **    the Free Software Foundation, either version 3 of the License, or
00008 **    (at your option) any later version.
00009 **
00010 **   This program is distributed in the hope that it will be useful,
00011 **    but WITHOUT ANY WARRANTY; without even the implied warranty of
00012 **    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013 **    GNU General Public License for more details.
00014 **
00015 **    You should have received a copy of the GNU General Public License
00016 **    along with this program.  If not, see <http://www.gnu.org/licenses/>.
00017 */
00018 
00019 #ifndef _MC_INT_PAIR_HPP_
00020 #define _MC_INT_PAIR_HPP_
00021 
00022 #include <stdlib.h>
00023 #include <iostream>
00024 
00025 
00026 
00027 
00028 namespace mesh_conv
00029 {
00030 
00034     class MC_int_pair
00035     {
00036     public:
00037 
00038 
00039         //************************************************//
00040         //************************************************//
00041         //CONSTRUCTORS
00042         //************************************************//
00043         //************************************************//
00044 
00046         MC_int_pair();
00048         MC_int_pair(const MC_int_pair& i);
00050         MC_int_pair(const int& _u0,const int& _u1);
00052         template <typename U,typename V>
00053                 MC_int_pair(const std::pair<U,V>& p):u0(p.first),u1(p.second){}
00055         ~MC_int_pair();
00056 
00057         //************************************************//
00058         //************************************************//
00059         //GET
00060         //************************************************//
00061         //************************************************//
00062 
00063 
00065         const int& operator[](const int& k) const;
00067         int& operator[](const int& k);
00069         const int& operator()(const int& k) const;
00071         int& operator()(const int& k);
00072 
00073 
00074         //************************************************//
00075         //************************************************//
00076         //Math Operator
00077         //************************************************//
00078         //************************************************//
00079 
00081         friend bool operator==(const MC_int_pair& p1,const MC_int_pair& p2);
00083         friend bool operator!=(const MC_int_pair& p1,const MC_int_pair& p2);
00084 
00086         MC_int_pair& operator=(const MC_int_pair& to_copy);
00087 
00088 
00092         friend MC_int_pair operator+(const MC_int_pair& p,const int& a);
00096         friend MC_int_pair operator-(const MC_int_pair& p,const int& a);
00097 
00098 
00099 
00101         MC_int_pair ordonated() const;
00102 
00106         void assert_bounds(const int& u) const;
00107 
00108         //************************************************//
00109         //************************************************//
00110         //Input Output
00111         //************************************************//
00112         //************************************************//
00113 
00115         friend std::ostream& operator << (std::ostream& flux,const MC_int_pair& _v);
00116 
00117 
00118     private:
00119 
00121         int u0,u1;
00122 
00123     };
00124 
00125 
00127     class MC_int_pair_less
00128     {
00129     public:
00130         bool operator()(const MC_int_pair& a,const MC_int_pair& b) const
00131         {
00132             MC_int_pair ca=a.ordonated();
00133             MC_int_pair cb=b.ordonated();
00134 
00135             if( (ca[0]<cb[0]) || (ca[0]==cb[0] && ca[1]<cb[1]) )
00136                 return true;
00137             return false;
00138         }
00139     private:
00140     };
00141 
00142 }
00143 #endif

Generated on Sun Apr 18 20:24:47 2010 by  doxygen 1.6.1