00001 #ifndef __J2K__JComplex_Compare_CPP__
00002 #define __J2K__JComplex_Compare_CPP__
00003
00004
00005
00006
00007 BOOL JComplex::Compare( const JComplex& c ) const {
00008 if (this == &c) return 1;
00009 return ( (Real == c.Real) && (Imag == c.Imag) );
00010 }
00011
00012 inline BOOL JComplex::operator==( const JComplex& c ) const {
00013 return Compare( c );
00014 }
00015
00016 inline BOOL JComplex::operator!=( const JComplex& c ) const {
00017 return !Compare( c );
00018 }
00019
00020
00021
00022
00023 BOOL JComplex::Compare( const CplxDouble r ) const {
00024 return ( (Real == r) && (Imag == 0) );
00025 }
00026
00027 inline BOOL JComplex::operator==( const CplxDouble r ) const {
00028 return Compare( r );
00029 }
00030
00031 inline BOOL JComplex::operator!=( const CplxDouble r ) const {
00032 return !Compare( r );
00033 }
00034
00035
00036
00037
00038 BOOL JComplex::Compare( const JComplex& l, const JComplex& r ) {
00039 return ( (l.Real == r.Real) && (l.Imag == r.Imag) );
00040 }
00041
00042 inline friend BOOL JComplex::operator==( const JComplex& left,
00043 const JComplex& right )
00044 {
00045 return Compare( left, right );
00046 }
00047
00048 inline friend BOOL JComplex::operator!=( const JComplex& left,
00049 const JComplex& right )
00050 {
00051 return Compare( left, right );
00052 }
00053
00054
00055
00056
00057 friend BOOL JComplex::Compare( const JComplex& l, const CplxDouble x )
00058 {
00059 return ( (l.Real == x) && (l.Imag == 0) );
00060 }
00061
00062 inline friend BOOL JComplex::operator==( const JComplex& left,
00063 const CplxDouble x )
00064 {
00065 return Compare( left, x );
00066 }
00067
00068 inline friend BOOL JComplex::operator!=( const JComplex& left,
00069 const CplxDouble x )
00070 {
00071 return Compare( left, x );
00072 }
00073
00074 inline friend BOOL JComplex::operator==( const CplxDouble x,
00075 const JComplex& right )
00076 {
00077 return Compare( right, x );
00078 }
00079
00080 inline friend BOOL JComplex::operator!=( const CplxDouble x,
00081 const JComplex& right )
00082 {
00083 return Compare( right, x );
00084 }
00085
00086 #endif