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

puncturing.h

Go to the documentation of this file.
00001 /***************************************************************************
00002                           puncturing.h  -  description
00003                              -------------------
00004     begin                : Thu Oct 16 2003
00005     copyright            : (C) 2003 by Peter Haase
00006     email                : mail@p-haase.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 PUNCTURING_H
00029 #define PUNCTURING_H
00030 
00031 
00032 #include "misc.h"
00033 #include "signals.h"
00034 
00035 namespace simthlib
00036 {
00037 
00041 class Puncturing
00042 {
00043   private:
00044 
00047     static const char *punct2[14][7];
00048 
00051     static const char *punct3[8][4];
00052 
00055     static const char *punct4;
00056 
00057 
00059     int pO;
00060 
00061     typedef simth::BitSeq::storage_type punctureTabType;
00062     punctureTabType punctureTab;
00063 
00066     int depuncturedLength;
00067 
00068   protected:
00069 
00073     int getDepuncturedLength( ) const;
00074 
00075     void invariant() const;
00076   public:
00084     Puncturing(int codeRateNumerator,int codeRateDenumerator,
00085                int memoryLength, int codeOutputBits, int codeInputBits = 1);
00086 
00087 
00088     Puncturing(const std::string& puncturePattern);
00089 
00093     void puncture(const simth::BitSeq &inputSequence, simth::BitSeq* outputSequence) const;
00094     void puncture(const simth::LlrSeq &inputSequence, simth::LlrSeq* outputSequence) const;
00095     void depuncture(const simth::LlrSeq &inputSequence, simth::LlrSeq* outputSequence) const;
00096 
00099     int getPuncturedLength(int len) const;
00100 
00107     int getDepuncturedLength(int len) const;
00108 
00114     void setDepuncturedLength (int outLen);
00115 
00116 
00117 };
00118 
00119 
00120 inline void Puncturing::invariant() const
00121 {
00122   if(DEBUG) {
00123     if(punctureTab.size() <= 0) {
00124       throw std::runtime_error("inline Puncturing::invariant() : error !");
00125     }
00126   }
00127 }
00128 
00129 inline void Puncturing::setDepuncturedLength(int outputLen)
00130 {
00131   if(DEBUG) {
00132     if(outputLen < 0) {
00133       throw std::runtime_error("inline int Puncturing::setOutputLength(int outputLen) const : "
00134                                "outputLen < 0");
00135     }
00136   }
00137   depuncturedLength = outputLen;
00138 }
00139 
00140 inline int Puncturing::getDepuncturedLength( ) const
00141 {
00142   if(DEBUG) {
00143     if(depuncturedLength < 0) {
00144       throw std::runtime_error("inline int Puncturing::getDepuncturedLength(int outputLen) const : "
00145                                "outputLength must be set before calling this function");
00146     }
00147   }
00148   return depuncturedLength;
00149 }
00150 
00151 }
00152 
00153 #endif

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