diff options
author | anastas | 2007-02-13 04:52:51 +0000 |
---|---|---|
committer | anastas | 2007-02-13 04:52:51 +0000 |
commit | f6ee48fda7ca4692808eaf57944d8b16ace4cb1c (patch) | |
tree | ef3551bac0362d98d4dd8d36494eec8288647bcf /gr-trellis/src | |
parent | 8c639b3bb3e92f42442c78069310654ca03a0743 (diff) | |
download | gnuradio-f6ee48fda7ca4692808eaf57944d8b16ace4cb1c.tar.gz gnuradio-f6ee48fda7ca4692808eaf57944d8b16ace4cb1c.tar.bz2 gnuradio-f6ee48fda7ca4692808eaf57944d8b16ace4cb1c.zip |
added methods to interleaver class for writting to text file
git-svn-id: http://gnuradio.org/svn/gnuradio/trunk@4463 221aa14e-8319-0410-a670-987f0aec2ac5
Diffstat (limited to 'gr-trellis/src')
-rw-r--r-- | gr-trellis/src/lib/interleaver.cc | 29 | ||||
-rw-r--r-- | gr-trellis/src/lib/interleaver.h | 1 | ||||
-rw-r--r-- | gr-trellis/src/lib/interleaver.i | 1 |
3 files changed, 31 insertions, 0 deletions
diff --git a/gr-trellis/src/lib/interleaver.cc b/gr-trellis/src/lib/interleaver.cc index 93c194709..ad33d78bf 100644 --- a/gr-trellis/src/lib/interleaver.cc +++ b/gr-trellis/src/lib/interleaver.cc @@ -23,11 +23,16 @@ #include <cstdlib> #include <cstdio> #include <iostream> +#include <string> +#include <fstream> #include <stdexcept> #include <cmath> #include "quicksort_index.h" #include "interleaver.h" + + + interleaver::interleaver() { d_K=0; @@ -104,3 +109,27 @@ interleaver::interleaver(int K, int seed) d_DEINTER[d_INTER[i]]=i; } } + + + + + +//###################################################################### +//# Write an INTERLEAVER specification from a file. +//# Format +//# K +//# blank line +//# list of space separated K integers from 0 to K-1 in appropriate order +//# optional comments +//###################################################################### +void interleaver::write_interleaver_txt(std::string filename) +{ + std::ofstream interleaver_fname (filename.c_str()); + if (!interleaver_fname) {std::cout << "file not found " << std::endl ; exit(-1);} + interleaver_fname << d_K << std::endl; + interleaver_fname << std::endl; + for(int i=0;i<d_K;i++) + interleaver_fname << d_INTER[i] << ' '; + interleaver_fname << std::endl; + interleaver_fname.close(); +} diff --git a/gr-trellis/src/lib/interleaver.h b/gr-trellis/src/lib/interleaver.h index 466b0cdd2..5282a4ba8 100644 --- a/gr-trellis/src/lib/interleaver.h +++ b/gr-trellis/src/lib/interleaver.h @@ -42,6 +42,7 @@ public: int K () const { return d_K; } const std::vector<int> & INTER () const { return d_INTER; } const std::vector<int> & DEINTER () const { return d_DEINTER; } + void write_interleaver_txt(std::string filename); }; #endif diff --git a/gr-trellis/src/lib/interleaver.i b/gr-trellis/src/lib/interleaver.i index a5e68dc58..30a97bf6b 100644 --- a/gr-trellis/src/lib/interleaver.i +++ b/gr-trellis/src/lib/interleaver.i @@ -34,4 +34,5 @@ public: int K () const { return d_K; }
const std::vector<int> & INTER () const { return d_INTER; }
const std::vector<int> & DEINTER () const { return d_DEINTER; }
+ void write_interleaver_txt(std::string filename);
};
|