diff options
author | Tom Rondeau | 2012-12-14 10:35:31 -0500 |
---|---|---|
committer | Tom Rondeau | 2012-12-14 10:35:31 -0500 |
commit | 8f7271cfe496346f34a6e7352ec0f597b79341a4 (patch) | |
tree | 721aa3e712c66d6942f8d878cc6f979c596fd829 /gnuradio-core | |
parent | d12b7b7511c9751af973d1f3cd8fc8020000f4ac (diff) | |
download | gnuradio-8f7271cfe496346f34a6e7352ec0f597b79341a4.tar.gz gnuradio-8f7271cfe496346f34a6e7352ec0f597b79341a4.tar.bz2 gnuradio-8f7271cfe496346f34a6e7352ec0f597b79341a4.zip |
core: use std::string in file metadata sink (easier to work with; matches source).
Diffstat (limited to 'gnuradio-core')
-rw-r--r-- | gnuradio-core/src/lib/io/gr_file_meta_sink.cc | 13 | ||||
-rw-r--r-- | gnuradio-core/src/lib/io/gr_file_meta_sink.h | 8 | ||||
-rw-r--r-- | gnuradio-core/src/lib/io/gr_file_meta_sink.i | 6 |
3 files changed, 13 insertions, 14 deletions
diff --git a/gnuradio-core/src/lib/io/gr_file_meta_sink.cc b/gnuradio-core/src/lib/io/gr_file_meta_sink.cc index 43900bcd9..2b722bc61 100644 --- a/gnuradio-core/src/lib/io/gr_file_meta_sink.cc +++ b/gnuradio-core/src/lib/io/gr_file_meta_sink.cc @@ -50,7 +50,7 @@ #endif gr_file_meta_sink_sptr -gr_make_file_meta_sink(size_t itemsize, const char *filename, +gr_make_file_meta_sink(size_t itemsize, const std::string &filename, double samp_rate, double relative_rate, gr_file_types type, bool complex, size_t max_segment_size, @@ -66,7 +66,7 @@ gr_make_file_meta_sink(size_t itemsize, const char *filename, detached_header)); } -gr_file_meta_sink::gr_file_meta_sink(size_t itemsize, const char *filename, +gr_file_meta_sink::gr_file_meta_sink(size_t itemsize, const std::string &filename, double samp_rate, double relative_rate, gr_file_types type, bool complex, size_t max_segment_size, @@ -149,16 +149,15 @@ gr_file_meta_sink::~gr_file_meta_sink() } bool -gr_file_meta_sink::open(const char *filename) +gr_file_meta_sink::open(const std::string &filename) { bool ret = true; if(d_state == STATE_DETACHED) { - std::stringstream s; - s << filename << ".hdr"; - ret = _open(&d_new_hdr_fp, s.str().c_str()); + std::string s = filename + ".hdr"; + ret = _open(&d_new_hdr_fp, s.c_str()); } - ret = ret && _open(&d_new_fp, filename); + ret = ret && _open(&d_new_fp, filename.c_str()); d_updated = true; return ret; } diff --git a/gnuradio-core/src/lib/io/gr_file_meta_sink.h b/gnuradio-core/src/lib/io/gr_file_meta_sink.h index e5374af2b..c0219ac25 100644 --- a/gnuradio-core/src/lib/io/gr_file_meta_sink.h +++ b/gnuradio-core/src/lib/io/gr_file_meta_sink.h @@ -48,7 +48,7 @@ class gr_file_meta_sink; typedef boost::shared_ptr<gr_file_meta_sink> gr_file_meta_sink_sptr; GR_CORE_API gr_file_meta_sink_sptr -gr_make_file_meta_sink(size_t itemsize, const char *filename, +gr_make_file_meta_sink(size_t itemsize, const std::string &filename, double samp_rate=1, double relative_rate=1, gr_file_types type=GR_FILE_FLOAT, bool complex=true, size_t max_segment_size=1000000, @@ -99,7 +99,7 @@ class GR_CORE_API gr_file_meta_sink : public gr_sync_block * info in a separate file (named filename.hdr) */ friend GR_CORE_API gr_file_meta_sink_sptr - gr_make_file_meta_sink(size_t itemsize, const char *filename, + gr_make_file_meta_sink(size_t itemsize, const std::string &filename, double samp_rate, double relative_rate, gr_file_types type, bool complex, size_t max_segment_size, @@ -130,7 +130,7 @@ class GR_CORE_API gr_file_meta_sink : public gr_sync_block meta_state_t d_state; protected: - gr_file_meta_sink(size_t itemsize, const char *filename, + gr_file_meta_sink(size_t itemsize, const std::string &filename, double samp_rate=1, double relative_rate=1, gr_file_types type=GR_FILE_FLOAT, bool complex=true, size_t max_segment_size=1000000, @@ -150,7 +150,7 @@ class GR_CORE_API gr_file_meta_sink : public gr_sync_block public: ~gr_file_meta_sink(); - bool open(const char *filename); + bool open(const std::string &filename); void close(); void do_update(); diff --git a/gnuradio-core/src/lib/io/gr_file_meta_sink.i b/gnuradio-core/src/lib/io/gr_file_meta_sink.i index 9513b090f..743e89730 100644 --- a/gnuradio-core/src/lib/io/gr_file_meta_sink.i +++ b/gnuradio-core/src/lib/io/gr_file_meta_sink.i @@ -37,7 +37,7 @@ enum gr_file_types { }; gr_file_meta_sink_sptr -gr_make_file_meta_sink(size_t itemsize, const char *filename, +gr_make_file_meta_sink(size_t itemsize, const std::string &filename, double samp_rate=1, double relative_rate=1, gr_file_types type=GR_FILE_FLOAT, bool complex=true, size_t max_segment_size=1000000, @@ -47,7 +47,7 @@ gr_make_file_meta_sink(size_t itemsize, const char *filename, class gr_file_meta_sink : public gr_sync_block { protected: - gr_file_meta_sink(size_t itemsize, const char *filename, + gr_file_meta_sink(size_t itemsize, const std::string &filename, double samp_rate, double relative_rate, gr_file_types type, bool complex, size_t max_segment_size, @@ -57,7 +57,7 @@ class gr_file_meta_sink : public gr_sync_block public: ~gr_file_meta_sink(); - bool open(const char *filename); + bool open(const std::string &filename); void close(); void set_unbuffered(bool unbuffered); }; |