commit-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Commit-gnuradio] r4035 - in gnuradio/branches/developers/jcorgan/hier:


From: jcorgan
Subject: [Commit-gnuradio] r4035 - in gnuradio/branches/developers/jcorgan/hier: gnuradio-core/src/lib/runtime gnuradio-examples/c++/hier
Date: Mon, 27 Nov 2006 16:55:25 -0700 (MST)

Author: jcorgan
Date: 2006-11-27 16:55:25 -0700 (Mon, 27 Nov 2006)
New Revision: 4035

Added:
   
gnuradio/branches/developers/jcorgan/hier/gnuradio-examples/c++/hier/output.cc
   gnuradio/branches/developers/jcorgan/hier/gnuradio-examples/c++/hier/output.h
   
gnuradio/branches/developers/jcorgan/hier/gnuradio-examples/c++/hier/siggen.cc
   gnuradio/branches/developers/jcorgan/hier/gnuradio-examples/c++/hier/siggen.h
Modified:
   
gnuradio/branches/developers/jcorgan/hier/gnuradio-core/src/lib/runtime/gr_hier_block2_detail.cc
   
gnuradio/branches/developers/jcorgan/hier/gnuradio-core/src/lib/runtime/gr_runtime_impl.cc
   
gnuradio/branches/developers/jcorgan/hier/gnuradio-examples/c++/hier/Makefile.am
   gnuradio/branches/developers/jcorgan/hier/gnuradio-examples/c++/hier/sink.cc
   
gnuradio/branches/developers/jcorgan/hier/gnuradio-examples/c++/hier/source.cc
Log:
Work in progress.

Modified: 
gnuradio/branches/developers/jcorgan/hier/gnuradio-core/src/lib/runtime/gr_hier_block2_detail.cc
===================================================================
--- 
gnuradio/branches/developers/jcorgan/hier/gnuradio-core/src/lib/runtime/gr_hier_block2_detail.cc
    2006-11-27 21:58:20 UTC (rev 4034)
+++ 
gnuradio/branches/developers/jcorgan/hier/gnuradio-core/src/lib/runtime/gr_hier_block2_detail.cc
    2006-11-27 23:55:25 UTC (rev 4035)
@@ -157,19 +157,30 @@
 gr_endpoint
 gr_hier_block2_detail::match_endpoint(const std::string &name, int port, bool 
is_input)
 {
-    // FIXME: Incomplete.  Need to resolve_endpoint on the match in case it is
-    // a hierarchical block.
+    std::string match_name;
+    int match_port;
 
     for (gr_edge_viter_t p = d_edges.begin(); p != d_edges.end(); p++) {
        if (is_input) {
-           if ((*p)->src_name() == name && (*p)->src_port() == port)
-               return gr_endpoint((*p)->dst_name(), (*p)->dst_port());
+           if ((*p)->src_name() == name && (*p)->src_port() == port) {
+               match_name = (*p)->dst_name();
+               match_port = (*p)->dst_port();
+               break;
+           }
        }
        else {
-           if ((*p)->dst_name() == name && (*p)->dst_port() == port)
-               return gr_endpoint((*p)->src_name(), (*p)->src_port());
+           if ((*p)->dst_name() == name && (*p)->dst_port() == port) {
+               match_name = (*p)->src_name();
+               match_port = (*p)->src_port();
+               break;
+           }
        }
     }
+
+    if (match_name == "")
+       throw std::runtime_error("unable to match endpoint");
+
+    return resolve_endpoint(match_name, match_port, "", !is_input);
 }
 
 gr_endpoint

Modified: 
gnuradio/branches/developers/jcorgan/hier/gnuradio-core/src/lib/runtime/gr_runtime_impl.cc
===================================================================
--- 
gnuradio/branches/developers/jcorgan/hier/gnuradio-core/src/lib/runtime/gr_runtime_impl.cc
  2006-11-27 21:58:20 UTC (rev 4034)
+++ 
gnuradio/branches/developers/jcorgan/hier/gnuradio-core/src/lib/runtime/gr_runtime_impl.cc
  2006-11-27 23:55:25 UTC (rev 4035)
@@ -55,6 +55,8 @@
        d_running = true;
 
     d_top_block->flatten(d_sfg);
+    d_sfg->validate();
+    d_sfg->setup_connections();
 }
 
 void 

Modified: 
gnuradio/branches/developers/jcorgan/hier/gnuradio-examples/c++/hier/Makefile.am
===================================================================
--- 
gnuradio/branches/developers/jcorgan/hier/gnuradio-examples/c++/hier/Makefile.am
    2006-11-27 21:58:20 UTC (rev 4034)
+++ 
gnuradio/branches/developers/jcorgan/hier/gnuradio-examples/c++/hier/Makefile.am
    2006-11-27 23:55:25 UTC (rev 4035)
@@ -37,12 +37,16 @@
 noinst_HEADERS = \
     dialtone.h \
     sink.h \
-    source.h 
+    source.h \
+    siggen.h \
+    output.h
         
 dialtone_SOURCES = \
     dialtone.cc           \
     source.cc \
     sink.cc \
+    siggen.cc \
+    output.cc \
     main.cc
 
 dialtone_LDADD = \

Added: 
gnuradio/branches/developers/jcorgan/hier/gnuradio-examples/c++/hier/output.cc
===================================================================
--- 
gnuradio/branches/developers/jcorgan/hier/gnuradio-examples/c++/hier/output.cc  
                            (rev 0)
+++ 
gnuradio/branches/developers/jcorgan/hier/gnuradio-examples/c++/hier/output.cc  
    2006-11-27 23:55:25 UTC (rev 4035)
@@ -0,0 +1,41 @@
+/*
+ * Copyright 2006 Free Software Foundation, Inc.
+ * 
+ * This file is part of GNU Radio
+ * 
+ * GNU Radio 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 2, or (at your option)
+ * any later version.
+ * 
+ * GNU Radio 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 GNU Radio; see the file COPYING.  If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include <output.h>
+#include <gr_io_signature.h>
+#include <audio_alsa_sink.h>
+
+// Shared pointer constructor
+output_sptr make_output()
+{
+    return output_sptr(new output());
+}
+
+output::output() : 
+gr_hier_block2("output",
+              gr_make_io_signature(2,2,sizeof(float)),
+              gr_make_io_signature(0,0,0))
+{
+    define_component("audio", audio_alsa_make_sink(48000));
+    
+    connect("self", 0, "audio", 0);
+    connect("self", 1, "audio", 1);
+}


Property changes on: 
gnuradio/branches/developers/jcorgan/hier/gnuradio-examples/c++/hier/output.cc
___________________________________________________________________
Name: svn:eol-style
   + native

Added: 
gnuradio/branches/developers/jcorgan/hier/gnuradio-examples/c++/hier/output.h
===================================================================
--- 
gnuradio/branches/developers/jcorgan/hier/gnuradio-examples/c++/hier/output.h   
                            (rev 0)
+++ 
gnuradio/branches/developers/jcorgan/hier/gnuradio-examples/c++/hier/output.h   
    2006-11-27 23:55:25 UTC (rev 4035)
@@ -0,0 +1,33 @@
+/*
+ * Copyright 2006 Free Software Foundation, Inc.
+ * 
+ * This file is part of GNU Radio
+ * 
+ * GNU Radio 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 2, or (at your option)
+ * any later version.
+ * 
+ * GNU Radio 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 GNU Radio; see the file COPYING.  If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include <gr_hier_block2.h>
+
+class output;
+typedef boost::shared_ptr<class output> output_sptr;
+output_sptr make_output();
+
+class output : public gr_hier_block2
+{
+private:
+    output();
+    friend output_sptr make_output();
+};


Property changes on: 
gnuradio/branches/developers/jcorgan/hier/gnuradio-examples/c++/hier/output.h
___________________________________________________________________
Name: svn:eol-style
   + native

Added: 
gnuradio/branches/developers/jcorgan/hier/gnuradio-examples/c++/hier/siggen.cc
===================================================================
--- 
gnuradio/branches/developers/jcorgan/hier/gnuradio-examples/c++/hier/siggen.cc  
                            (rev 0)
+++ 
gnuradio/branches/developers/jcorgan/hier/gnuradio-examples/c++/hier/siggen.cc  
    2006-11-27 23:55:25 UTC (rev 4035)
@@ -0,0 +1,42 @@
+/*
+ * Copyright 2006 Free Software Foundation, Inc.
+ * 
+ * This file is part of GNU Radio
+ * 
+ * GNU Radio 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 2, or (at your option)
+ * any later version.
+ * 
+ * GNU Radio 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 GNU Radio; see the file COPYING.  If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include <siggen.h>
+#include <gr_io_signature.h>
+#include <gr_sig_source_f.h>
+
+// Shared pointer constructor
+siggen_sptr make_siggen()
+{
+    return siggen_sptr(new siggen());
+}
+
+siggen::siggen() : 
+gr_hier_block2("siggen",
+              gr_make_io_signature(0,0,0),
+              gr_make_io_signature(2,2,sizeof(float)))
+{
+    define_component("siggen0", gr_make_sig_source_f(48000, GR_SIN_WAVE, 350, 
0.5));
+    define_component("siggen1", gr_make_sig_source_f(48000, GR_SIN_WAVE, 440, 
0.5));
+
+    connect("siggen0", 0, "self", 0);
+    connect("siggen1", 0, "self", 1);
+}


Property changes on: 
gnuradio/branches/developers/jcorgan/hier/gnuradio-examples/c++/hier/siggen.cc
___________________________________________________________________
Name: svn:eol-style
   + native

Added: 
gnuradio/branches/developers/jcorgan/hier/gnuradio-examples/c++/hier/siggen.h
===================================================================
--- 
gnuradio/branches/developers/jcorgan/hier/gnuradio-examples/c++/hier/siggen.h   
                            (rev 0)
+++ 
gnuradio/branches/developers/jcorgan/hier/gnuradio-examples/c++/hier/siggen.h   
    2006-11-27 23:55:25 UTC (rev 4035)
@@ -0,0 +1,33 @@
+/*
+ * Copyright 2006 Free Software Foundation, Inc.
+ * 
+ * This file is part of GNU Radio
+ * 
+ * GNU Radio 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 2, or (at your option)
+ * any later version.
+ * 
+ * GNU Radio 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 GNU Radio; see the file COPYING.  If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include <gr_hier_block2.h>
+
+class siggen;
+typedef boost::shared_ptr<class siggen> siggen_sptr;
+siggen_sptr make_siggen();
+
+class siggen : public gr_hier_block2
+{
+private:
+    siggen();
+    friend siggen_sptr make_siggen();
+};


Property changes on: 
gnuradio/branches/developers/jcorgan/hier/gnuradio-examples/c++/hier/siggen.h
___________________________________________________________________
Name: svn:eol-style
   + native

Modified: 
gnuradio/branches/developers/jcorgan/hier/gnuradio-examples/c++/hier/sink.cc
===================================================================
--- 
gnuradio/branches/developers/jcorgan/hier/gnuradio-examples/c++/hier/sink.cc    
    2006-11-27 21:58:20 UTC (rev 4034)
+++ 
gnuradio/branches/developers/jcorgan/hier/gnuradio-examples/c++/hier/sink.cc    
    2006-11-27 23:55:25 UTC (rev 4035)
@@ -22,7 +22,7 @@
 #include <sink.h>
 #include <gr_io_signature.h>
 #include <gr_nop.h>
-#include <audio_alsa_sink.h>
+#include <output.h>
 
 // Shared pointer constructor
 sink_sptr make_sink()
@@ -36,10 +36,10 @@
               gr_make_io_signature(0,0,0))
 {
     define_component("nop", gr_make_nop(sizeof(float)));
-    define_component("audio", audio_alsa_make_sink(48000));
+    define_component("output", make_output());
 
     connect("self", 0, "nop",   0);
     connect("self", 1, "nop",   1);
-    connect("nop",  0, "audio", 0);
-    connect("nop",  1, "audio", 1);    
+    connect("nop",  0, "output", 0);
+    connect("nop",  1, "output", 1);    
 }

Modified: 
gnuradio/branches/developers/jcorgan/hier/gnuradio-examples/c++/hier/source.cc
===================================================================
--- 
gnuradio/branches/developers/jcorgan/hier/gnuradio-examples/c++/hier/source.cc  
    2006-11-27 21:58:20 UTC (rev 4034)
+++ 
gnuradio/branches/developers/jcorgan/hier/gnuradio-examples/c++/hier/source.cc  
    2006-11-27 23:55:25 UTC (rev 4035)
@@ -21,8 +21,7 @@
 
 #include <source.h>
 #include <gr_io_signature.h>
-#include <gr_sig_source_f.h>
-#include <gr_nop.h>
+#include <siggen.h>
 
 // Shared pointer constructor
 source_sptr make_source()
@@ -35,12 +34,8 @@
               gr_make_io_signature(0,0,0),
               gr_make_io_signature(2,2,sizeof(float)))
 {
-    define_component("src0", gr_make_sig_source_f(48000, GR_SIN_WAVE, 350, 
0.5));
-    define_component("src1", gr_make_sig_source_f(48000, GR_SIN_WAVE, 440, 
0.5));
-    define_component("nop", gr_make_nop(sizeof(float)));
+    define_component("siggen", make_siggen());
 
-    connect("src0", 0, "nop", 0);
-    connect("src1", 0, "nop", 1);
-    connect("nop", 0, "self", 0);
-    connect("nop", 1, "self", 1);
+    connect("siggen", 0, "self", 0);
+    connect("siggen", 1, "self", 1);
 }





reply via email to

[Prev in Thread] Current Thread [Next in Thread]