00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #ifndef CONVERTER_H
00029 #define CONVERTER_H
00030
00031 #include "basicdevicefactory.h"
00032 #include "basicdevice.h"
00033 #include "phbib.h"
00034 #include "signals.h"
00035 #include "multiplexer.h"
00036 #include "adaptiveModulator.h"
00037
00038 namespace simthlib
00039 {
00040
00068 template<class seqT_in, class seqT_out>
00069 class ConverterT : public Multiplexer
00070 {
00071 public:
00072 ConverterT(int deviceID, simth::DeviceSystemIntf* system,
00073 const simth::PropertyList& pl)
00074 : Multiplexer (deviceID, system, pl, 1, 1)
00075 {
00076 insertInputInterface< seqT_in >();
00077 insertOutputInterface< seqT_out >();
00078 }
00079
00080 void process()
00081 {
00082 if (inputLength() != outputLength())
00083 throw std::runtime_error("ConverterT::process(): unequal input/output data length");
00084
00085 if (!isInputInterfaceConnected (0))
00086 throw simth::ParameterErr("ConverterT::process(): Input interface is not connected");
00087 if (!isOutputInterfaceConnected (0))
00088 throw simth::ParameterErr("ConverterT::process(): Output interface is not connected");
00089
00090 seqT_in* iseq = getInputSequence< seqT_in >(0);
00091 seqT_out* oseq = getOutputSequence< seqT_out >(0);
00092
00093 unsigned iLength = inputLength();
00094
00095
00096 for (unsigned n = 0; n < iLength; n++)
00097 oseq->operator[](n) =
00098 static_cast<typename seqT_out::value_type> ( iseq->operator[](n) );
00099
00100 flushProcessedSequences();
00101 }
00102
00103
00104 void print(std::ostream &os) const
00105 { os<<"#ConverterT"; simth::Device::print (os); }
00106 };
00107
00127 template<class seqT_in, class seqT_out>
00128 class CmplToReIm : public Multiplexer
00129 {
00130 public:
00131 CmplToReIm(int deviceID, simth::DeviceSystemIntf* system,
00132 const simth::PropertyList& pl);
00133
00134 void process();
00135
00136 void print(std::ostream &os) const
00137 { os<<"#CmplToReIm"; simth::Device::print (os); }
00138 };
00139
00159 template<class seqT_in, class seqT_out>
00160 class CmplToAbsArg : public Multiplexer
00161 {
00162 public:
00163 CmplToAbsArg(int deviceID, simth::DeviceSystemIntf* system,
00164 const simth::PropertyList& pl);
00165
00166 void process();
00167
00168 void print(std::ostream &os) const
00169 { os<<"#CmplToAbsArg"; simth::Device::print (os); }
00170 };
00171
00172
00173
00184 class LlrToBit : public Multiplexer
00185 {
00186 public:
00187 LlrToBit(int deviceID, simth::DeviceSystemIntf* system,
00188 const simth::PropertyList& pl);
00189
00190 void process();
00191
00192 void print(std::ostream &os) const
00193 { os<<"#LlrToBit"; simth::Device::print (os); }
00194
00195 static void init(const std::string& fileName,
00196 simth::Device** dev,
00197 simth::DeviceSystemIntf* sysPtr,
00198 int ID,
00199 const std::string& regionQualifier);
00200 };
00202 class BitToLlr : public Multiplexer
00203 {
00204 public:
00205 BitToLlr(int deviceID, simth::DeviceSystemIntf* system,
00206 const simth::PropertyList& pl);
00207
00208 void process();
00209
00210 void print(std::ostream &os) const
00211 { os<<"#BitToLlr"; simth::Device::print (os); }
00212 };
00213
00215 class LoadingInfoToAmpl : public Multiplexer
00216 {
00217 public:
00218 LoadingInfoToAmpl(int deviceID, simth::DeviceSystemIntf* system,
00219 const simth::PropertyList& pl)
00220 : Multiplexer (deviceID, system, pl, 1, 1)
00221 {
00222 insertInputInterface< simth::LoadingInfoSeq >();
00223 insertOutputInterface< simth::LlrSeq >();
00224 }
00225
00226 void process();
00227
00228 void print(std::ostream &os) const
00229 { os<<"#LoadingInfoToAmpl"; simth::Device::print (os); }
00230 };
00232 class LoadingInfoToBits : public Multiplexer
00233 {
00234 public:
00235 LoadingInfoToBits(int deviceID, simth::DeviceSystemIntf* system,
00236 const simth::PropertyList& pl)
00237 : Multiplexer (deviceID, system, pl, 1, 1)
00238 {
00239 insertInputInterface< simth::LoadingInfoSeq >();
00240 insertOutputInterface< simth::LlrSeq >();
00241 }
00242
00243 void process();
00244
00245 void print(std::ostream &os) const
00246 { os<<"#LoadingInfoToBits"; simth::Device::print (os); }
00247 };
00248
00249
00250 namespace Convert
00251 {
00252 void init(const std::string& fileName,
00253 simth::Device** dev,
00254 simth::DeviceSystemIntf* sysPtr,
00255 int ID,
00256 const std::string& regionQualifier);
00257
00258 void init(simth::DeviceFactory& registration);
00259
00260 }
00261
00262 }
00263
00264 #endif