IT++ Logo

cfixed.h

Go to the documentation of this file.
00001 
00030 #ifndef CFIXED_H
00031 #define CFIXED_H
00032 
00033 #ifndef _MSC_VER
00034 #  include <itpp/config.h>
00035 #else
00036 #  include <itpp/config_msvc.h>
00037 #endif
00038 
00039 #include <itpp/fixed/cfix.h>
00040 
00041 
00042 namespace itpp {
00043 
00054   template<int w, e_mode e=TC, o_mode o=WRAP, q_mode q=TRN>
00055   class CFixed : public CFix {
00056   public:
00058     CFixed(double r=0.0, double i=0.0, int s=0, Stat *ptr=0)
00059       : CFix(r, i, s, w, e, o, q, ptr) {}
00061     CFixed(std::complex<double> x, double dummy=0.0, int s=0, Stat *ptr=0)
00062       : CFix(x, 0.0, s, w, e, o, q, ptr) {}
00064     explicit CFixed(Stat *ptr)
00065       : CFix(0.0, 0.0, 0, w, e, o, q, ptr) {}
00067     CFixed(const Fix &r, const Fix &i=0.0, Stat *ptr=0)
00068       : CFix(r, i, w, e, o, q, ptr) {}
00070     CFixed(const CFix &x, double dummy=0.0, Stat *ptr=0)
00071       : CFix(x, 0.0, w, e, o, q, ptr) {}
00073     virtual ~CFixed() {}
00074 
00076     CFixed& operator=(const CFix &x)
00077     {
00078       shift = x.shift;
00079       re = apply_o_mode(x.re);
00080       im = apply_o_mode(x.im);
00081       return *this;
00082     }
00084     CFixed& operator=(const Fix &x)
00085     {
00086       shift = x.shift;
00087       re = apply_o_mode(x.re);
00088       im = 0;
00089       return *this;
00090     }
00092     CFixed& operator=(const std::complex<double> &x)
00093     {
00094       shift = 0;
00095       re = apply_o_mode(fixrep(real(x)));
00096       im = apply_o_mode(fixrep(imag(x)));
00097       return *this;
00098     }
00100     CFixed& operator=(int x)
00101     {
00102       shift = 0;
00103       re = apply_o_mode(x);
00104       im = 0;
00105       return *this;
00106     }
00107   protected:
00108   };
00109 
00112 
00113   typedef CFixed<1, TC, WRAP> cfixed1;
00115   typedef CFixed<2, TC, WRAP> cfixed2;
00116   typedef CFixed<3, TC, WRAP> cfixed3;
00117   typedef CFixed<4, TC, WRAP> cfixed4;
00118   typedef CFixed<5, TC, WRAP> cfixed5;
00119   typedef CFixed<6, TC, WRAP> cfixed6;
00120   typedef CFixed<7, TC, WRAP> cfixed7;
00121   typedef CFixed<8, TC, WRAP> cfixed8;
00122   typedef CFixed<9, TC, WRAP> cfixed9;
00123   typedef CFixed<10, TC, WRAP> cfixed10;
00124   typedef CFixed<11, TC, WRAP> cfixed11;
00125   typedef CFixed<12, TC, WRAP> cfixed12;
00126   typedef CFixed<13, TC, WRAP> cfixed13;
00127   typedef CFixed<14, TC, WRAP> cfixed14;
00128   typedef CFixed<15, TC, WRAP> cfixed15;
00129   typedef CFixed<16, TC, WRAP> cfixed16;
00130   typedef CFixed<17, TC, WRAP> cfixed17;
00131   typedef CFixed<18, TC, WRAP> cfixed18;
00132   typedef CFixed<19, TC, WRAP> cfixed19;
00133   typedef CFixed<20, TC, WRAP> cfixed20;
00134   typedef CFixed<21, TC, WRAP> cfixed21;
00135   typedef CFixed<22, TC, WRAP> cfixed22;
00136   typedef CFixed<23, TC, WRAP> cfixed23;
00137   typedef CFixed<24, TC, WRAP> cfixed24;
00138   typedef CFixed<25, TC, WRAP> cfixed25;
00139   typedef CFixed<26, TC, WRAP> cfixed26;
00140   typedef CFixed<27, TC, WRAP> cfixed27;
00141   typedef CFixed<28, TC, WRAP> cfixed28;
00142   typedef CFixed<29, TC, WRAP> cfixed29;
00143   typedef CFixed<30, TC, WRAP> cfixed30;
00144   typedef CFixed<31, TC, WRAP> cfixed31;
00145   typedef CFixed<32, TC, WRAP> cfixed32;
00146   typedef CFixed<33, TC, WRAP> cfixed33;
00147   typedef CFixed<34, TC, WRAP> cfixed34;
00148   typedef CFixed<35, TC, WRAP> cfixed35;
00149   typedef CFixed<36, TC, WRAP> cfixed36;
00150   typedef CFixed<37, TC, WRAP> cfixed37;
00151   typedef CFixed<38, TC, WRAP> cfixed38;
00152   typedef CFixed<39, TC, WRAP> cfixed39;
00153   typedef CFixed<40, TC, WRAP> cfixed40;
00154   typedef CFixed<41, TC, WRAP> cfixed41;
00155   typedef CFixed<42, TC, WRAP> cfixed42;
00156   typedef CFixed<43, TC, WRAP> cfixed43;
00157   typedef CFixed<44, TC, WRAP> cfixed44;
00158   typedef CFixed<45, TC, WRAP> cfixed45;
00159   typedef CFixed<46, TC, WRAP> cfixed46;
00160   typedef CFixed<47, TC, WRAP> cfixed47;
00161   typedef CFixed<48, TC, WRAP> cfixed48;
00162   typedef CFixed<49, TC, WRAP> cfixed49;
00163   typedef CFixed<50, TC, WRAP> cfixed50;
00164   typedef CFixed<51, TC, WRAP> cfixed51;
00165   typedef CFixed<52, TC, WRAP> cfixed52;
00166   typedef CFixed<53, TC, WRAP> cfixed53;
00167   typedef CFixed<54, TC, WRAP> cfixed54;
00168   typedef CFixed<55, TC, WRAP> cfixed55;
00169   typedef CFixed<56, TC, WRAP> cfixed56;
00170   typedef CFixed<57, TC, WRAP> cfixed57;
00171   typedef CFixed<58, TC, WRAP> cfixed58;
00172   typedef CFixed<59, TC, WRAP> cfixed59;
00173   typedef CFixed<60, TC, WRAP> cfixed60;
00174   typedef CFixed<61, TC, WRAP> cfixed61;
00175   typedef CFixed<62, TC, WRAP> cfixed62;
00176   typedef CFixed<63, TC, WRAP> cfixed63;
00177   typedef CFixed<64, TC, WRAP> cfixed64;
00179 
00181   typedef CFixed<1, TC, WRAP> cfixed1;
00183   typedef CFixed<1, TC, SAT> scfixed1;
00184   typedef CFixed<2, TC, SAT> scfixed2;
00185   typedef CFixed<3, TC, SAT> scfixed3;
00186   typedef CFixed<4, TC, SAT> scfixed4;
00187   typedef CFixed<5, TC, SAT> scfixed5;
00188   typedef CFixed<6, TC, SAT> scfixed6;
00189   typedef CFixed<7, TC, SAT> scfixed7;
00190   typedef CFixed<8, TC, SAT> scfixed8;
00191   typedef CFixed<9, TC, SAT> scfixed9;
00192   typedef CFixed<10, TC, SAT> scfixed10;
00193   typedef CFixed<11, TC, SAT> scfixed11;
00194   typedef CFixed<12, TC, SAT> scfixed12;
00195   typedef CFixed<13, TC, SAT> scfixed13;
00196   typedef CFixed<14, TC, SAT> scfixed14;
00197   typedef CFixed<15, TC, SAT> scfixed15;
00198   typedef CFixed<16, TC, SAT> scfixed16;
00199   typedef CFixed<17, TC, SAT> scfixed17;
00200   typedef CFixed<18, TC, SAT> scfixed18;
00201   typedef CFixed<19, TC, SAT> scfixed19;
00202   typedef CFixed<20, TC, SAT> scfixed20;
00203   typedef CFixed<21, TC, SAT> scfixed21;
00204   typedef CFixed<22, TC, SAT> scfixed22;
00205   typedef CFixed<23, TC, SAT> scfixed23;
00206   typedef CFixed<24, TC, SAT> scfixed24;
00207   typedef CFixed<25, TC, SAT> scfixed25;
00208   typedef CFixed<26, TC, SAT> scfixed26;
00209   typedef CFixed<27, TC, SAT> scfixed27;
00210   typedef CFixed<28, TC, SAT> scfixed28;
00211   typedef CFixed<29, TC, SAT> scfixed29;
00212   typedef CFixed<30, TC, SAT> scfixed30;
00213   typedef CFixed<31, TC, SAT> scfixed31;
00214   typedef CFixed<32, TC, SAT> scfixed32;
00215   typedef CFixed<33, TC, SAT> scfixed33;
00216   typedef CFixed<34, TC, SAT> scfixed34;
00217   typedef CFixed<35, TC, SAT> scfixed35;
00218   typedef CFixed<36, TC, SAT> scfixed36;
00219   typedef CFixed<37, TC, SAT> scfixed37;
00220   typedef CFixed<38, TC, SAT> scfixed38;
00221   typedef CFixed<39, TC, SAT> scfixed39;
00222   typedef CFixed<40, TC, SAT> scfixed40;
00223   typedef CFixed<41, TC, SAT> scfixed41;
00224   typedef CFixed<42, TC, SAT> scfixed42;
00225   typedef CFixed<43, TC, SAT> scfixed43;
00226   typedef CFixed<44, TC, SAT> scfixed44;
00227   typedef CFixed<45, TC, SAT> scfixed45;
00228   typedef CFixed<46, TC, SAT> scfixed46;
00229   typedef CFixed<47, TC, SAT> scfixed47;
00230   typedef CFixed<48, TC, SAT> scfixed48;
00231   typedef CFixed<49, TC, SAT> scfixed49;
00232   typedef CFixed<50, TC, SAT> scfixed50;
00233   typedef CFixed<51, TC, SAT> scfixed51;
00234   typedef CFixed<52, TC, SAT> scfixed52;
00235   typedef CFixed<53, TC, SAT> scfixed53;
00236   typedef CFixed<54, TC, SAT> scfixed54;
00237   typedef CFixed<55, TC, SAT> scfixed55;
00238   typedef CFixed<56, TC, SAT> scfixed56;
00239   typedef CFixed<57, TC, SAT> scfixed57;
00240   typedef CFixed<58, TC, SAT> scfixed58;
00241   typedef CFixed<59, TC, SAT> scfixed59;
00242   typedef CFixed<60, TC, SAT> scfixed60;
00243   typedef CFixed<61, TC, SAT> scfixed61;
00244   typedef CFixed<62, TC, SAT> scfixed62;
00245   typedef CFixed<63, TC, SAT> scfixed63;
00246   typedef CFixed<64, TC, SAT> scfixed64;
00247 
00248   // ----------------------------------------------------------------------
00249   // Instantiations
00250   // ----------------------------------------------------------------------
00251 #ifdef HAVE_EXTERN_TEMPLATE
00252   extern template class CFixed<64, TC, WRAP>;
00253 #endif // HAVE_EXTERN_TEMPLATE
00254 
00256 
00257 } // namespace itpp
00258 
00259 #endif // #ifndef CFIXED_H
SourceForge Logo

Generated on Sun Apr 20 12:40:06 2008 for IT++ by Doxygen 1.5.5