mesh_conv::MC_int_pair Class Reference

Container class for pair of int. More...

#include <MC_int_pair.hpp>

List of all members.

Public Member Functions

 MC_int_pair ()
 Empty constructor.
 MC_int_pair (const MC_int_pair &i)
 copy constructor
 MC_int_pair (const int &_u0, const int &_u1)
 direct constructor
template<typename U , typename V >
 MC_int_pair (const std::pair< U, V > &p)
 constructor from std::pair(a,b)
 ~MC_int_pair ()
 destructor
const int & operator[] (const int &k) const
 access (k must be 0 or 1)
int & operator[] (const int &k)
 access (k must be 0 or 1)
const int & operator() (const int &k) const
 access (k must be 0 or 1)
int & operator() (const int &k)
 access (k must be 0 or 1)
MC_int_pairoperator= (const MC_int_pair &to_copy)
 affectation
MC_int_pair ordonated () const
 ordonate the int_pair in the same order (lower value is the first one)
void assert_bounds (const int &u) const
 assert the index is either 0 or 1

Private Attributes

int u0
 the pair
int u1

Friends

bool operator== (const MC_int_pair &p1, const MC_int_pair &p2)
 test equality
bool operator!= (const MC_int_pair &p1, const MC_int_pair &p2)
 test equality
MC_int_pair operator+ (const MC_int_pair &p, const int &a)
 add a value to the pair
MC_int_pair operator- (const MC_int_pair &p, const int &a)
 substract a value to the pair
std::ostream & operator<< (std::ostream &flux, const MC_int_pair &_v)

Detailed Description

Container class for pair of int.

(u0,u1) == (u1,u0)

Definition at line 34 of file MC_int_pair.hpp.


Constructor & Destructor Documentation

mesh_conv::MC_int_pair::MC_int_pair (  ) 

Empty constructor.

Definition at line 8 of file MC_int_pair.cpp.

References u0, and u1.

Referenced by ordonated().

00008 {u0=0;u1=0;}

Here is the caller graph for this function:

mesh_conv::MC_int_pair::MC_int_pair ( const MC_int_pair i  ) 

copy constructor

Definition at line 9 of file MC_int_pair.cpp.

References u0, and u1.

00009 {u0=input.u0;u1=input.u1;}

mesh_conv::MC_int_pair::MC_int_pair ( const int &  _u0,
const int &  _u1 
)

direct constructor

Definition at line 10 of file MC_int_pair.cpp.

References u0, and u1.

00010 {u0=_u0;u1=_u1;}

template<typename U , typename V >
mesh_conv::MC_int_pair::MC_int_pair ( const std::pair< U, V > &  p  )  [inline]

constructor from std::pair(a,b)

Definition at line 53 of file MC_int_pair.hpp.

00053 :u0(p.first),u1(p.second){}

mesh_conv::MC_int_pair::~MC_int_pair (  ) 

destructor

Definition at line 11 of file MC_int_pair.cpp.

00011 {}


Member Function Documentation

void mesh_conv::MC_int_pair::assert_bounds ( const int &  u  )  const

assert the index is either 0 or 1

Returns:
nothing, but stop the programm if it goes outside bounds

Definition at line 40 of file MC_int_pair.cpp.

Referenced by operator()(), and operator[]().

00041     {
00042         if(u!=0 && u!=1)
00043         {std::cout<<"Error in MC_int_pair::assert_bounds("<<u<<"), index must be 0 or 1"<<std::endl;exit(-1);}
00044     }

Here is the caller graph for this function:

int & mesh_conv::MC_int_pair::operator() ( const int &  k  ) 

access (k must be 0 or 1)

Definition at line 64 of file MC_int_pair.cpp.

References assert_bounds(), u0, and u1.

00065     {
00066         assert_bounds(k);
00067         if(k==0) return u0;
00068         return u1;
00069     }

Here is the call graph for this function:

const int & mesh_conv::MC_int_pair::operator() ( const int &  k  )  const

access (k must be 0 or 1)

Definition at line 58 of file MC_int_pair.cpp.

References assert_bounds(), u0, and u1.

00059     {
00060         assert_bounds(k);
00061         if(k==0) return u0;
00062         return u1;
00063     }

Here is the call graph for this function:

MC_int_pair & mesh_conv::MC_int_pair::operator= ( const MC_int_pair to_copy  ) 

affectation

Definition at line 27 of file MC_int_pair.cpp.

References u0, and u1.

00028                                        {
00029         u0=to_copy[0];
00030         u1=to_copy[1];
00031         return *this;
00032     }

int & mesh_conv::MC_int_pair::operator[] ( const int &  k  ) 

access (k must be 0 or 1)

Definition at line 52 of file MC_int_pair.cpp.

References assert_bounds(), u0, and u1.

00053     {
00054         assert_bounds(k);
00055         if(k==0) return u0;
00056         return u1;
00057     }

Here is the call graph for this function:

const int & mesh_conv::MC_int_pair::operator[] ( const int &  k  )  const

access (k must be 0 or 1)

Definition at line 46 of file MC_int_pair.cpp.

References assert_bounds(), u0, and u1.

00047     {
00048         assert_bounds(k);
00049         if(k==0) return u0;
00050         return u1;
00051     }

Here is the call graph for this function:

MC_int_pair mesh_conv::MC_int_pair::ordonated (  )  const

ordonate the int_pair in the same order (lower value is the first one)

Definition at line 71 of file MC_int_pair.cpp.

References MC_int_pair(), u0, and u1.

Referenced by mesh_conv::MC_int_pair_less::operator()().

00072     {
00073         if(u0<u1)
00074             return MC_int_pair(u0,u1);
00075         return MC_int_pair(u1,u0);
00076     }

Here is the call graph for this function:

Here is the caller graph for this function:


Friends And Related Function Documentation

bool operator!= ( const MC_int_pair p1,
const MC_int_pair p2 
) [friend]

test equality

MC_int_pair operator+ ( const MC_int_pair p,
const int &  a 
) [friend]

add a value to the pair

Returns:
a pair (x0,x1)+a=(x0+a,x1+a)
MC_int_pair operator- ( const MC_int_pair p,
const int &  a 
) [friend]

substract a value to the pair

Returns:
a pair (x0,x1)-a=(x0-a,x1-a)
std::ostream& operator<< ( std::ostream &  flux,
const MC_int_pair _v 
) [friend]

output

bool operator== ( const MC_int_pair p1,
const MC_int_pair p2 
) [friend]

test equality


Member Data Documentation


The documentation for this class was generated from the following files:

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