IT++ Logo Newcom Logo

cfixed.h

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

Generated on Fri Jun 8 00:37:34 2007 for IT++ by Doxygen 1.5.2