cartesian.h

Go to the documentation of this file.
00001 //
00002 // Cartesian template class
00003 // by Bala Amavasai (and notes on the internet!)
00004 // Tue Mar 13 18:04:22 GMT 2001 
00005 //
00006 // Wrote this to simplify task of creating STL lists of coordinate pairs.
00007 // Don't know if it overlaps with Stuart's classes, but who cares.
00008 
00009 
00010 
00011 #ifndef CARTESIAN_H
00012 #define CARTESIAN_H
00013 
00014 
00015 #include <iostream>
00016 
00017 namespace mimas {
00018 
00019 
00020 template <typename T>
00021 class Cartesian
00022 {
00023 
00024   public:
00025       typedef std::ostream ostream;
00026     T x, y;
00027     
00028     Cartesian()
00029     {
00030       x=0;
00031       y=0;
00032     }
00033     
00034     ~Cartesian(){}
00035     
00036     Cartesian(const Cartesian &copycoord)
00037     {
00038       x=copycoord.x;
00039       y=copycoord.y;
00040     }
00041     
00042     
00043     friend ostream &operator<<(ostream &output,
00044                                       const Cartesian &outcoord)
00045     {
00046       output << outcoord.x << ' ' << outcoord.y;
00047       return output;
00048     }
00049     
00050     
00051     Cartesian& operator=(const Cartesian &rhs)
00052     {
00053       this->x=rhs.x;
00054       this->y=rhs.y;
00055       return *this;
00056     }
00057     
00058     int operator==(const Cartesian &rhs) const
00059     {
00060       if (this->x!=rhs.x) return 0;
00061       if (this->y!=rhs.y) return 0;
00062       return 1;
00063     }
00064     
00065     int operator<(const Cartesian &rhs) const
00066     {
00067       if (this->x < rhs.x) return 1;
00068       if (this->y < rhs.y) return 1;
00069       return 0;
00070     }
00071         
00072 };
00073 
00074 }
00075 #endif

[GNU/Linux] [Qt] [Mesa] [STL] [Lapack] [Boost] [Magick++] [Xalan-C and Xerces-C] [doxygen] [graphviz] [FFTW] [popt] [xine] [Gnuplot] [gnu-arch] [gcc] [gstreamer] [autoconf/automake/make] [freshmeat.net] [opensource.org] [sourceforge.net] [MMVL]
mimas 2.1 - Copyright Mon Oct 30 11:31:16 2006, Bala Amavasai, Stuart Meikle, Arul Selvan, Fabio Caparrelli, Jan Wedekind, Manuel Boissenin, ...