[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] [gnuradio] 10/29: zeromq: fixups and stylistic changes
From: |
git |
Subject: |
[Commit-gnuradio] [gnuradio] 10/29: zeromq: fixups and stylistic changes before merge |
Date: |
Tue, 13 Jan 2015 01:04:27 +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 57c8dd13b4ede4bf255327611afcd877d6f881f3
Author: Johnathan Corgan <address@hidden>
Date: Fri Oct 31 15:45:21 2014 -0700
zeromq: fixups and stylistic changes before merge
---
gr-zeromq/lib/pub_sink_impl.cc | 2 +-
gr-zeromq/lib/pub_sink_impl.h | 4 +--
gr-zeromq/lib/pull_source_impl.h | 2 +-
gr-zeromq/lib/push_sink_impl.h | 2 +-
gr-zeromq/lib/rep_sink_impl.h | 4 +--
gr-zeromq/lib/req_source_impl.cc | 2 +-
gr-zeromq/lib/req_source_impl.h | 4 +--
gr-zeromq/lib/sub_source_impl.h | 2 +-
gr-zeromq/lib/tag_headers.cc | 74 ++++++++++++++++++++++++++++------------
gr-zeromq/lib/tag_headers.h | 36 +++++++++++++++++--
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 4573990..6804c1d 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 049e587..100b0f5 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 f25013b..7578679 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 2590a7f..924dee3 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 68bb9eb..55ebb69 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 2cc61e4..6e2ad3d 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 d37d73b..7c6bc53 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 f528294..0fa8d17 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 778ceee..b45025d 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 51cb0c0..03300f8 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 */
- [Commit-gnuradio] [gnuradio] 16/29: zmq: naming cleanup, (continued)
- [Commit-gnuradio] [gnuradio] 16/29: zmq: naming cleanup, git, 2015/01/12
- [Commit-gnuradio] [gnuradio] 17/29: zmq: pull_msg_source should be working, git, 2015/01/12
- [Commit-gnuradio] [gnuradio] 20/29: zeromq: cleanup and convert pub_msg_sink to derive from gr::block, git, 2015/01/12
- [Commit-gnuradio] [gnuradio] 23/29: zeromq: cleanup and made pull_msg_source derive from gr::block, git, 2015/01/12
- [Commit-gnuradio] [gnuradio] 07/29: zmq: all source blocks should now support tag headers, git, 2015/01/12
- [Commit-gnuradio] [gnuradio] 06/29: zmq: hoisting tag parsing into helper function, should now be easy to use in other zmq blocks, git, 2015/01/12
- [Commit-gnuradio] [gnuradio] 14/29: zmq: Adding zmq pub/sub blocks for message passing, git, 2015/01/12
- [Commit-gnuradio] [gnuradio] 21/29: zeromq: cleanup and convert sub_msg_source to derive from gr::block, git, 2015/01/12
- [Commit-gnuradio] [gnuradio] 22/29: zeromq: cleanup and converted push_msg_sink to derive from gr::block, git, 2015/01/12
- [Commit-gnuradio] [gnuradio] 01/29: zmq: encoding tags into zmq stream, git, 2015/01/12
- [Commit-gnuradio] [gnuradio] 10/29: zeromq: fixups and stylistic changes before merge,
git <=
- [Commit-gnuradio] [gnuradio] 24/29: zeromq: cleanup and converted rep_msg_sink to derive from gr::block, git, 2015/01/12
- [Commit-gnuradio] [gnuradio] 08/29: zmq: sync blocks now all support tag headers, git, 2015/01/12
- [Commit-gnuradio] [gnuradio] 12/29: zmq: stream tag passing now works, git, 2015/01/12
- [Commit-gnuradio] [gnuradio] 19/29: Merge remote-tracking branch 'osh/zmqtags' into zmq_tags, git, 2015/01/12
- [Commit-gnuradio] [gnuradio] 29/29: Merge branch 'maint', git, 2015/01/12
- [Commit-gnuradio] [gnuradio] 26/29: zeromq: added msg passing example, git, 2015/01/12
- [Commit-gnuradio] [gnuradio] 03/29: zmq: default to not pass tags (compatible wire format), git, 2015/01/12
- [Commit-gnuradio] [gnuradio] 02/29: zmq: tags should now be serializing and deserializing correctly for pub_sink/sub_source, git, 2015/01/12
- [Commit-gnuradio] [gnuradio] 27/29: zeromq: minor cleanup, git, 2015/01/12
- [Commit-gnuradio] [gnuradio] 25/29: zeromq: cleanup and made req_msg_source derive from gr::block, git, 2015/01/12