[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] [gnuradio] 01/11: pmt_io: adding string conversion for
From: |
git |
Subject: |
[Commit-gnuradio] [gnuradio] 01/11: pmt_io: adding string conversion for uniform vectors |
Date: |
Fri, 13 Jun 2014 22:44:32 +0000 (UTC) |
This is an automated email from the git hooks/post-receive script.
jcorgan pushed a commit to branch master
in repository gnuradio.
commit dbd2aee42a4bba767b8f1daf0801fd0aac304be7
Author: Marcus Müller <address@hidden>
Date: Sat Apr 12 17:04:54 2014 +0200
pmt_io: adding string conversion for uniform vectors
Sadly, this needed expansion of unv_template, otherwise I'd have to
hand-write gengen-style code in pmt_io.cc
---
gnuradio-runtime/lib/pmt/generate_unv.py | 1 +
gnuradio-runtime/lib/pmt/pmt_int.h | 1 +
gnuradio-runtime/lib/pmt/pmt_io.cc | 13 ++++++++++---
gnuradio-runtime/lib/pmt/unv_template.cc.t | 6 ++++++
gnuradio-runtime/lib/pmt/unv_template.h.t | 1 +
5 files changed, 19 insertions(+), 3 deletions(-)
diff --git a/gnuradio-runtime/lib/pmt/generate_unv.py
b/gnuradio-runtime/lib/pmt/generate_unv.py
index 7562df4..6218099 100755
--- a/gnuradio-runtime/lib/pmt/generate_unv.py
+++ b/gnuradio-runtime/lib/pmt/generate_unv.py
@@ -76,6 +76,7 @@ includes = """
#endif
#include <vector>
#include <pmt/pmt.h>
+#include <boost/lexical_cast.hpp>
#include "pmt_int.h"
"""
diff --git a/gnuradio-runtime/lib/pmt/pmt_int.h
b/gnuradio-runtime/lib/pmt/pmt_int.h
index aceb7b7..25bcdb9 100644
--- a/gnuradio-runtime/lib/pmt/pmt_int.h
+++ b/gnuradio-runtime/lib/pmt/pmt_int.h
@@ -238,6 +238,7 @@ public:
virtual const void *uniform_elements(size_t &len) = 0;
virtual void *uniform_writable_elements(size_t &len) = 0;
virtual size_t length() const = 0;
+ virtual const std::string string_ref(size_t k) const { return
std::string("FIXME"); }
};
#include "pmt_unv_int.h"
diff --git a/gnuradio-runtime/lib/pmt/pmt_io.cc
b/gnuradio-runtime/lib/pmt/pmt_io.cc
index 17bdee4..acad8fc 100644
--- a/gnuradio-runtime/lib/pmt/pmt_io.cc
+++ b/gnuradio-runtime/lib/pmt/pmt_io.cc
@@ -110,9 +110,16 @@ write(pmt_t obj, std::ostream &port)
port << "#<dict>";
}
else if (is_uniform_vector(obj)){
- // FIXME
- // port << "#<uniform-vector " << obj << ">";
- port << "#<uniform-vector>";
+ port << "#[";
+ size_t len = length(obj);
+ if (len)
+ {
+ pmt_uniform_vector *uv = dynamic_cast<pmt_uniform_vector*>(obj.get());
+ port << uv->string_ref(0);
+ for (size_t i = 1; i < len; i++)
+ port << " " << uv->string_ref(i);
+ }
+ port << "]";
}
else {
error:
diff --git a/gnuradio-runtime/lib/pmt/unv_template.cc.t
b/gnuradio-runtime/lib/pmt/unv_template.cc.t
index 8678894..c8020e7 100644
--- a/gnuradio-runtime/lib/pmt/unv_template.cc.t
+++ b/gnuradio-runtime/lib/pmt/unv_template.cc.t
@@ -138,4 +138,10 @@ const std::vector< @TYPE@ >
return address@hidden@vector(vector)->writable_elements(len);
}
+const std::string
address@hidden@vector::string_ref(size_t k) const
+{
+ return boost::lexical_cast< std::string, @TYPE@ > (ref(k));
+}
+
} /* namespace pmt */
diff --git a/gnuradio-runtime/lib/pmt/unv_template.h.t
b/gnuradio-runtime/lib/pmt/unv_template.h.t
index 83ba0be..cdf72d4 100644
--- a/gnuradio-runtime/lib/pmt/unv_template.h.t
+++ b/gnuradio-runtime/lib/pmt/unv_template.h.t
@@ -20,4 +20,5 @@ public:
@TYPE@ *writable_elements(size_t &len);
const void *uniform_elements(size_t &len);
void *uniform_writable_elements(size_t &len);
+ virtual const std::string string_ref(size_t k) const;
};
- [Commit-gnuradio] [gnuradio] branch master updated (34ee3b7 -> 80ec147), git, 2014/06/13
- [Commit-gnuradio] [gnuradio] 02/11: grc: Fixed scroll functionality in GRC. Also added clear and scrollback capability for the logging window, git, 2014/06/13
- [Commit-gnuradio] [gnuradio] 01/11: pmt_io: adding string conversion for uniform vectors,
git <=
- [Commit-gnuradio] [gnuradio] 09/11: pager: Add sync code for FLEX 3200 bps 2-FSK encoding, git, 2014/06/13
- [Commit-gnuradio] [gnuradio] 10/11: Merge remote-tracking branch 'gnuradio-wg-grc/grc_scroll_fix', git, 2014/06/13
- [Commit-gnuradio] [gnuradio] 05/11: Merge branch 'maint', git, 2014/06/13
- [Commit-gnuradio] [gnuradio] 08/11: blocks: added I/Q swap option to interleaved_short_to_complex, git, 2014/06/13
- [Commit-gnuradio] [gnuradio] 03/11: grc: Changed dialog to directly call the SCROLL_LOCK and CLEAR_REPORTS actions. Moved clear reports under view and grouped all Report menu items together, git, 2014/06/13
- [Commit-gnuradio] [gnuradio] 04/11: grc: minor edits. removed extra whitespace, git, 2014/06/13
- [Commit-gnuradio] [gnuradio] 11/11: Merge remote-tracking branch 'deuxpi/pager-flex-3200-fsk2', git, 2014/06/13
- [Commit-gnuradio] [gnuradio] 06/11: Merge remote-tracking branch 'mmueller/pmt_io_uniform_vector_to_string', git, 2014/06/13
- [Commit-gnuradio] [gnuradio] 07/11: runtime: accessor for message port map & printing more informative error when a msg port is not found, git, 2014/06/13