tuples.h

Go to the documentation of this file.
00001 
00002 
00003 #ifndef _tuples_H_
00004 #define _tuples_H_
00005 
00006 
00007 #include "iostream"
00008 using namespace std;
00009 
00010 
00011 //---------------------------------------------------------------------------//
00012 //-------------------------------- triple -----------------------------------//
00013 //---------------------------------------------------------------------------//
00014 
00015 
00016 template< class T1 , class T2 , class T3 > 
00017 class triple
00018 {
00019 
00021   //                                                     //
00022   //  Constructors                                       //
00023   //                                                     //
00025 
00026 public:
00027 
00028   triple( const T1& t1=T1() , const T2& t2=T2() , const T3& t3=T3() ) : first(t1), second(t2), third(t3) { }
00029 
00030 
00032   //                                                     //
00033   //  Accessors:                                         //
00034   //                                                     //
00036 
00037  public:
00038 
00039   bool operator == ( const triple& t ) const {
00040     return first==t.first && second==t.second && third==t.third;
00041   }
00042 
00043   bool operator != ( const triple& t ) const {
00044     return first!=t.first || second!=t.second || third!=t.third;
00045   }
00046 
00047   bool operator> ( const triple& t ) const {
00048     if( first>t.first )
00049       return true;
00050     if( first<t.first )
00051       return false;
00052 
00053     if( second>t.second )
00054       return true;
00055     if( second<t.second )
00056       return false;
00057 
00058     if( third>t.third )
00059       return true;
00060     return false;
00061   }
00062   
00063   bool operator< ( const triple& t ) const {
00064     if( first<t.first )
00065       return true;
00066     if( first>t.first )
00067       return false;
00068 
00069     if( second<t.second )
00070       return true;
00071     if( second>t.second )
00072       return false;
00073 
00074     if( third<t.third )
00075       return true;
00076     return false;
00077   }
00078 
00080   //                                                     //
00081   //  I/O:                                               //
00082   //                                                     //
00084 
00085 public:
00086 
00087   friend ostream& operator << ( ostream& os , const triple& t ) {
00088     os << "<" << t.first << "," << t.second << "," << t.third << ">";
00089     return os;
00090   }
00091 
00093   //                                                     //
00094   //  Data members                                       //
00095   //                                                     //
00097 
00098 public:
00099 
00100   T1 first;
00101   T2 second;
00102   T3 third;
00103 };
00104 
00105 
00106 
00107 //---------------------------------------------------------------------------//
00108 //------------------------------- quadruple ---------------------------------//
00109 //---------------------------------------------------------------------------//
00110 
00111 
00112 template< class T1 , class T2 , class T3 , class T4 >
00113 class quadruple
00114 {
00115 
00117   //                                                     //
00118   //  Constructors                                       //
00119   //                                                     //
00121 
00122 public:
00123 
00124   quadruple( const T1& t1=T1() , const T2& t2=T2() , const T3& t3=T3() , const T4& t4=T4() ) : first(t1), second(t2), third(t3), fourth(t4) { }
00125 
00126 
00128   //                                                     //
00129   //  Accessors:                                         //
00130   //                                                     //
00132 
00133  public:
00134 
00135   bool operator< ( const quadruple& q ) const {
00136     if( first<q.first )
00137       return true;
00138     if( first>q.first )
00139       return false;
00140 
00141     if( second<q.second )
00142       return true;
00143     if( second>q.second )
00144       return false;
00145 
00146     if( third<q.third )
00147       return true;
00148     if( third>q.third )
00149       return false;
00150 
00151     if( fourth<q.fourth )
00152       return true;
00153     return false;
00154   }
00155 
00157   //                                                     //
00158   //  I/O:                                               //
00159   //                                                     //
00161 
00162 public:
00163 
00164   friend ostream& operator << ( ostream& os , const quadruple& t ) {
00165     os << "<" << t.first << "," << t.second << "," << t.third << "," << t.fourth << ">";
00166     return os;
00167   }
00168 
00170   //                                                     //
00171   //  Data members                                       //
00172   //                                                     //
00174 
00175 public:
00176 
00177   T1 first;
00178   T2 second;
00179   T3 third;
00180   T4 fourth;
00181 };
00182 
00183 
00184 //---------------------------------------------------------------------------//
00185 //------------------------------- quintuple ---------------------------------//
00186 //---------------------------------------------------------------------------//
00187 
00188 
00189 template< class T1 , class T2 , class T3 , class T4 , class T5 >
00190 class quintuple
00191 {
00192 
00194   //                                                     //
00195   //  Constructors                                       //
00196   //                                                     //
00198 
00199 public:
00200   
00201   quintuple( const T1& t1=T1() , const T2& t2=T2() , const T3& t3=T3() , const T4& t4=T4() , const T5& t5=T5() ) : first(t1), second(t2), third(t3), fourth(t4), fifth(t5) { }
00202 
00203 
00205   //                                                     //
00206   //  Accessors:                                         //
00207   //                                                     //
00209 
00210  public:
00211 
00212   bool operator< ( const quintuple& q ) const {
00213     if( first<q.first )
00214       return true;
00215     if( first>q.first )
00216       return false;
00217 
00218     if( second<q.second )
00219       return true;
00220     if( second>q.second )
00221       return false;
00222 
00223     if( third<q.third )
00224       return true;
00225     if( third>q.third )
00226       return false;
00227 
00228     if( fourth<q.fourth )
00229       return true;
00230     if( fourth>q.fourth )
00231       return false;
00232 
00233     if( fifth<q.fifth )
00234       return true;
00235     return false;
00236   }
00237   
00239   //                                                     //
00240   //  I/O:                                               //
00241   //                                                     //
00243 
00244 public:
00245 
00246   friend ostream& operator << ( ostream& os , const quintuple& t ) {
00247     os << "<" << t.first << "," << t.second << "," << t.third << "," << t.fourth << "," << t.fifth << ">";
00248     return os;
00249   }
00250 
00251   
00253   //                                                     //
00254   //  Data members                                       //
00255   //                                                     //
00257 
00258 public:
00259 
00260   T1 first;
00261   T2 second;
00262   T3 third;
00263   T4 fourth;
00264   T4 fifth;
00265 };
00266 
00267 #endif
00268 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on Mon Sep 26 18:43:45 2011 for CRyptography And Groups (CRAG) by  doxygen 1.6.1