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 
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      /*printf("Converter::process(): iLength %d, oLength %d\n",
00095        iLength, oLength);*/
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 } // namespace Convert
00261 
00262 } // namespace simthlib
00263 
00264 #endif /* CONVERTER_H */

Generated on Fri Jul 15 16:16:45 2005 for simtheticlib by  doxygen 1.4.1