MC_int_pair.hpp
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
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
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
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
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
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