Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

convert.h

Go to the documentation of this file.
00001 /***************************************************************************
00002  ** @file converter.h General converter
00003                              -------------------
00004     begin                : Wed December 11 2002
00005     copyright            : (C) 2002 by Christian Stimming
00006     email                : stimming@tuhh.de
00007  ***************************************************************************/
00008 
00009 /***************************************************************************
00010  *                                                                         *
00011  *   This library is free software; you can redistribute it and/or         *
00012  *   modify it under the terms of the GNU Lesser General Public            *
00013  *   License as published by the Free Software Foundation; either          *
00014  *   version 2.1 of the License, or (at your option) any later version.    *
00015  *                                                                         *
00016  *   This library is distributed in the hope that it will be useful,       *
00017  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00018  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU     *
00019  *   Lesser General Public License for more details.                       *
00020  *                                                                         *
00021  *   You should have received a copy of the GNU Lesser General Public      *
00022  *   License along with this library; if not, write to the Free Software   *
00023  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston,                 *
00024  *   MA  02111-1307  USA                                                   *
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    virtual ~ConverterT()
00080      { }
00081 
00082    void process()
00083       {
00084      if (inputLength() != outputLength())
00085         throw std::runtime_error("ConverterT::process(): unequal input/output data length");
00086 
00087      if (!isInputInterfaceConnected (0))
00088         throw simth::ParameterErr("ConverterT::process(): Input interface is not connected");
00089      if (!isOutputInterfaceConnected (0))
00090         throw simth::ParameterErr("ConverterT::process(): Output interface is not connected");
00091 
00092      seqT_in* iseq = getInputSequence< seqT_in >(0);
00093      seqT_out* oseq = getOutputSequence< seqT_out >(0);
00094 
00095      unsigned iLength = inputLength();
00096      /*printf("Converter::process(): iLength %d, oLength %d\n",
00097        iLength, oLength);*/
00098      for (unsigned n = 0; n < iLength; n++)
00099         oseq->operator[](n) =
00100            static_cast<typename seqT_out::value_type> ( iseq->operator[](n) );
00101 
00102      flushProcessedSequences();
00103       }
00104 
00105 
00106    void print(std::ostream &os) const
00107       { os<<"#ConverterT"; simth::Device::print (os); }
00108 };
00109 
00129 template<class seqT_in, class seqT_out>
00130 class CmplToReIm : public Multiplexer
00131 {
00132   public:
00133     CmplToReIm(int deviceID, simth::DeviceSystemIntf* system,
00134            const simth::PropertyList& pl);
00135 
00136     void process();
00137 
00138     void print(std::ostream &os) const
00139       { os<<"#CmplToReIm"; simth::Device::print (os); }
00140 };
00141 
00161 template<class seqT_in, class seqT_out>
00162 class CmplToAbsArg : public Multiplexer
00163 {
00164   public:
00165     CmplToAbsArg(int deviceID, simth::DeviceSystemIntf* system,
00166          const simth::PropertyList& pl);
00167 
00168     void process();
00169 
00170     void print(std::ostream &os) const
00171       { os<<"#CmplToAbsArg"; simth::Device::print (os); }
00172 };
00173 
00174 
00175 
00186 class LlrToBit : public Multiplexer
00187 {
00188   public:
00189     LlrToBit(int deviceID, simth::DeviceSystemIntf* system,
00190          const simth::PropertyList& pl);
00191 
00192     void process();
00193 
00194     void print(std::ostream &os) const
00195       { os<<"#LlrToBit"; simth::Device::print (os); }
00196 
00197     static void init(const std::string& fileName,
00198                      simth::Device** dev,
00199                      simth::DeviceSystemIntf* sysPtr,
00200                      int ID,
00201                      const std::string& regionQualifier);
00202 };
00204 class BitToLlr : public Multiplexer
00205 {
00206   public:
00207     BitToLlr(int deviceID, simth::DeviceSystemIntf* system,
00208          const simth::PropertyList& pl);
00209 
00210     void process();
00211 
00212     void print(std::ostream &os) const
00213       { os<<"#BitToLlr"; simth::Device::print (os); }
00214 };
00215 
00217 class LoadingInfoToAmpl : public Multiplexer
00218 {
00219   public:
00220     LoadingInfoToAmpl(int deviceID, simth::DeviceSystemIntf* system,
00221             const simth::PropertyList& pl)
00222       : Multiplexer (deviceID, system, pl, 1, 1)
00223       {
00224     insertInputInterface< simth::LoadingInfoSeq >();
00225     insertOutputInterface< simth::LlrSeq >();
00226       }
00227 
00228     void process();
00229 
00230     void print(std::ostream &os) const
00231       { os<<"#LoadingInfoToAmpl"; simth::Device::print (os); }
00232 };
00234 class LoadingInfoToBits : public Multiplexer
00235 {
00236   public:
00237     LoadingInfoToBits(int deviceID, simth::DeviceSystemIntf* system,
00238             const simth::PropertyList& pl)
00239       : Multiplexer (deviceID, system, pl, 1, 1)
00240       {
00241     insertInputInterface< simth::LoadingInfoSeq >();
00242     insertOutputInterface< simth::LlrSeq >();
00243       }
00244 
00245     void process();
00246 
00247     void print(std::ostream &os) const
00248       { os<<"#LoadingInfoToBits"; simth::Device::print (os); }
00249 };
00250 
00251 
00252 namespace Convert
00253 {
00254 void init(const std::string& fileName,
00255           simth::Device** dev,
00256           simth::DeviceSystemIntf* sysPtr,
00257           int ID,
00258           const std::string& regionQualifier);
00259 
00260 void init(simth::DeviceFactory& registration);
00261 
00262 } // namespace Convert
00263 
00264 } // namespace simthlib
00265 
00266 #endif /* CONVERTER_H */

Generated on Tue Aug 9 14:35:10 2005 for simtheticlib by  doxygen 1.4.1