summaryrefslogtreecommitdiff
path: root/gr-zeromq
diff options
context:
space:
mode:
authorJohnathan Corgan <johnathan@corganlabs.com>2014-10-31 15:45:21 -0700
committerJohnathan Corgan <johnathan@corganlabs.com>2014-10-31 15:45:21 -0700
commit57c8dd13b4ede4bf255327611afcd877d6f881f3 (patch)
treed1a8bbce050a6ce34c660ab627bcdc7c66c34417 /gr-zeromq
parent5aa1e1c359021c8539810c84f972b364d254203a (diff)
zeromq: fixups and stylistic changes before merge
Diffstat (limited to 'gr-zeromq')
-rw-r--r--gr-zeromq/lib/pub_sink_impl.cc2
-rw-r--r--gr-zeromq/lib/pub_sink_impl.h4
-rw-r--r--gr-zeromq/lib/pull_source_impl.h2
-rw-r--r--gr-zeromq/lib/push_sink_impl.h2
-rw-r--r--gr-zeromq/lib/rep_sink_impl.h4
-rw-r--r--gr-zeromq/lib/req_source_impl.cc2
-rw-r--r--gr-zeromq/lib/req_source_impl.h4
-rw-r--r--gr-zeromq/lib/sub_source_impl.h2
-rw-r--r--gr-zeromq/lib/tag_headers.cc74
-rw-r--r--gr-zeromq/lib/tag_headers.h36
10 files changed, 98 insertions, 34 deletions
diff --git a/gr-zeromq/lib/pub_sink_impl.cc b/gr-zeromq/lib/pub_sink_impl.cc
index 45739900b3..6804c1d9ce 100644
--- a/gr-zeromq/lib/pub_sink_impl.cc
+++ b/gr-zeromq/lib/pub_sink_impl.cc
@@ -35,7 +35,7 @@ namespace gr {
pub_sink::make(size_t itemsize, size_t vlen, char *address, int timeout, bool pass_tags)
{
return gnuradio::get_initial_sptr
- (new pub_sink_impl(itemsize, vlen, address, timeout));
+ (new pub_sink_impl(itemsize, vlen, address, timeout, pass_tags));
}
pub_sink_impl::pub_sink_impl(size_t itemsize, size_t vlen, char *address, int timeout, bool pass_tags)
diff --git a/gr-zeromq/lib/pub_sink_impl.h b/gr-zeromq/lib/pub_sink_impl.h
index 049e5876f6..100b0f5b8c 100644
--- a/gr-zeromq/lib/pub_sink_impl.h
+++ b/gr-zeromq/lib/pub_sink_impl.h
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2013 Free Software Foundation, Inc.
+ * Copyright 2013,2014 Free Software Foundation, Inc.
*
* This file is part of GNU Radio.
*
@@ -40,7 +40,7 @@ namespace gr {
bool d_pass_tags;
public:
- pub_sink_impl(size_t itemsize, size_t vlen, char *address, int timeout, bool pass_tags=false);
+ pub_sink_impl(size_t itemsize, size_t vlen, char *address, int timeout, bool pass_tags);
~pub_sink_impl();
int work(int noutput_items,
diff --git a/gr-zeromq/lib/pull_source_impl.h b/gr-zeromq/lib/pull_source_impl.h
index f25013b373..757867998d 100644
--- a/gr-zeromq/lib/pull_source_impl.h
+++ b/gr-zeromq/lib/pull_source_impl.h
@@ -40,7 +40,7 @@ namespace gr {
bool d_pass_tags;
public:
- pull_source_impl(size_t itemsize, size_t vlen, char *address, int timeout, bool pass_tags=false);
+ pull_source_impl(size_t itemsize, size_t vlen, char *address, int timeout, bool pass_tags);
~pull_source_impl();
int work(int noutput_items,
diff --git a/gr-zeromq/lib/push_sink_impl.h b/gr-zeromq/lib/push_sink_impl.h
index 2590a7f692..924dee3f15 100644
--- a/gr-zeromq/lib/push_sink_impl.h
+++ b/gr-zeromq/lib/push_sink_impl.h
@@ -40,7 +40,7 @@ namespace gr {
bool d_pass_tags;
public:
- push_sink_impl(size_t itemsize, size_t vlen, char *address, int timeout, bool pass_tags=false);
+ push_sink_impl(size_t itemsize, size_t vlen, char *address, int timeout, bool pass_tags);
~push_sink_impl();
int work(int noutput_items,
diff --git a/gr-zeromq/lib/rep_sink_impl.h b/gr-zeromq/lib/rep_sink_impl.h
index 68bb9eb776..55ebb69bfa 100644
--- a/gr-zeromq/lib/rep_sink_impl.h
+++ b/gr-zeromq/lib/rep_sink_impl.h
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2013,204 Free Software Foundation, Inc.
+ * Copyright 2013,2014 Free Software Foundation, Inc.
*
* This file is part of GNU Radio.
*
@@ -40,7 +40,7 @@ namespace gr {
bool d_pass_tags;
public:
- rep_sink_impl(size_t itemsize, size_t vlen, char *address, int timeout, bool pass_tags=false);
+ rep_sink_impl(size_t itemsize, size_t vlen, char *address, int timeout, bool pass_tags);
~rep_sink_impl();
int work(int noutput_items,
diff --git a/gr-zeromq/lib/req_source_impl.cc b/gr-zeromq/lib/req_source_impl.cc
index 2cc61e40d9..6e2ad3daf4 100644
--- a/gr-zeromq/lib/req_source_impl.cc
+++ b/gr-zeromq/lib/req_source_impl.cc
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2013 Free Software Foundation, Inc.
+ * Copyright 2013,2014 Free Software Foundation, Inc.
*
* This file is part of GNU Radio.
*
diff --git a/gr-zeromq/lib/req_source_impl.h b/gr-zeromq/lib/req_source_impl.h
index d37d73b525..7c6bc5310a 100644
--- a/gr-zeromq/lib/req_source_impl.h
+++ b/gr-zeromq/lib/req_source_impl.h
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2013 Free Software Foundation, Inc.
+ * Copyright 2013,2014 Free Software Foundation, Inc.
*
* This file is part of GNU Radio.
*
@@ -40,7 +40,7 @@ namespace gr {
bool d_pass_tags;
public:
- req_source_impl(size_t itemsize, size_t vlen, char *address, int timeout, bool pass_tags=false);
+ req_source_impl(size_t itemsize, size_t vlen, char *address, int timeout, bool pass_tags);
~req_source_impl();
int work(int noutput_items,
diff --git a/gr-zeromq/lib/sub_source_impl.h b/gr-zeromq/lib/sub_source_impl.h
index f52829463e..0fa8d179cd 100644
--- a/gr-zeromq/lib/sub_source_impl.h
+++ b/gr-zeromq/lib/sub_source_impl.h
@@ -40,7 +40,7 @@ namespace gr {
bool d_pass_tags;
public:
- sub_source_impl(size_t itemsize, size_t vlen, char *address, int timeout, bool pass_tags=false);
+ sub_source_impl(size_t itemsize, size_t vlen, char *address, int timeout, bool pass_tags);
~sub_source_impl();
int work(int noutput_items,
diff --git a/gr-zeromq/lib/tag_headers.cc b/gr-zeromq/lib/tag_headers.cc
index 778ceeef71..b45025d904 100644
--- a/gr-zeromq/lib/tag_headers.cc
+++ b/gr-zeromq/lib/tag_headers.cc
@@ -1,32 +1,61 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2014 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio.
+ *
+ * This is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this software; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
#include <gnuradio/io_signature.h>
#include <gnuradio/block.h>
#include <sstream>
#include <cstring>
-std::string gen_tag_header(uint64_t &offset, std::vector<gr::tag_t> &tags){
- std::stringstream ss;
- size_t ntags = tags.size();
- ss.write( reinterpret_cast< const char* >( offset ), sizeof(uint64_t) ); // offset
- ss.write( reinterpret_cast< const char* >( &ntags ), sizeof(size_t) ); // num tags
- std::stringbuf sb("");
- for(size_t i=0; i<tags.size(); i++){
+namespace gr {
+ namespace zeromq {
+
+ std::string
+ gen_tag_header(uint64_t &offset, std::vector<gr::tag_t> &tags) {
+
+ std::stringstream ss;
+ size_t ntags = tags.size();
+ ss.write( reinterpret_cast< const char* >( offset ), sizeof(uint64_t) ); // offset
+ ss.write( reinterpret_cast< const char* >( &ntags ), sizeof(size_t) ); // num tags
+ std::stringbuf sb("");
+ for(size_t i=0; i<tags.size(); i++){
ss.write( reinterpret_cast< const char* >( &tags[i].offset ), sizeof(uint64_t) ); // offset
sb.str("");
pmt::serialize( tags[i].key, sb ); // key
pmt::serialize( tags[i].value, sb ); // value
pmt::serialize( tags[i].srcid, sb ); // srcid
- ss.write( sb.str().c_str() , sb.str().length() ); // offset
- }
- return ss.str();
-}
-
-std::string parse_tag_header(std::string &buf_in, uint64_t &offset_out, std::vector<gr::tag_t> tags_out){
- std::istringstream iss( buf_in );
- size_t rcv_ntags;
- iss.read( (char*)&offset_out, sizeof(uint64_t ) );
- iss.read( (char*)&rcv_ntags, sizeof(size_t ) );
- for(size_t i=0; i<rcv_ntags; i++){
+ ss.write( sb.str().c_str() , sb.str().length() );
+ }
+
+ return ss.str();
+ }
+
+ std::string
+ parse_tag_header(std::string &buf_in, uint64_t &offset_out, std::vector<gr::tag_t> tags_out) {
+
+ std::istringstream iss( buf_in );
+ size_t rcv_ntags;
+ iss.read( (char*)&offset_out, sizeof(uint64_t ) );
+ iss.read( (char*)&rcv_ntags, sizeof(size_t ) );
+ for(size_t i=0; i<rcv_ntags; i++){
gr::tag_t newtag;
iss.read( (char*)&newtag.offset, sizeof(uint64_t ) );
std::stringbuf sb( iss.str() );
@@ -35,6 +64,9 @@ std::string parse_tag_header(std::string &buf_in, uint64_t &offset_out, std::vec
newtag.srcid = pmt::deserialize( sb );
tags_out.push_back(newtag);
iss.str(sb.str());
- }
- return iss.str();
-}
+ }
+
+ return iss.str();
+ }
+ } /* namespace zeromq */
+} /* namespace gr */
diff --git a/gr-zeromq/lib/tag_headers.h b/gr-zeromq/lib/tag_headers.h
index 51cb0c0e6b..03300f881a 100644
--- a/gr-zeromq/lib/tag_headers.h
+++ b/gr-zeromq/lib/tag_headers.h
@@ -1,8 +1,40 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2014 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio.
+ *
+ * This is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this software; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef ZEROMQ_TAG_HEADERS_H
+#define ZEROMQ_TAG_HEADERS_H
#include <gnuradio/io_signature.h>
#include <gnuradio/block.h>
#include <sstream>
#include <cstring>
-std::string gen_tag_header(uint64_t &offset, std::vector<gr::tag_t> &tags);
-std::string parse_tag_header(std::string &buf_in, uint64_t &offset_out, std::vector<gr::tag_t> tags_out);
+namespace gr {
+ namespace zeromq {
+
+ std::string gen_tag_header(uint64_t &offset, std::vector<gr::tag_t> &tags);
+ std::string parse_tag_header(std::string &buf_in, uint64_t &offset_out, std::vector<gr::tag_t> tags_out);
+
+ } /* namespace zeromq */
+} /* namespace gr */
+
+#endif /* ZEROMQ_TAG_HEADERS_H */