[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] r3860 - gnuradio/branches/developers/jcorgan/cppwrap/g
From: |
jcorgan |
Subject: |
[Commit-gnuradio] r3860 - gnuradio/branches/developers/jcorgan/cppwrap/gnuradio-core/src/lib/runtime |
Date: |
Thu, 26 Oct 2006 12:12:12 -0600 (MDT) |
Author: jcorgan
Date: 2006-10-26 12:12:11 -0600 (Thu, 26 Oct 2006)
New Revision: 3860
Modified:
gnuradio/branches/developers/jcorgan/cppwrap/gnuradio-core/src/lib/runtime/gr_basic_flowgraph.cc
gnuradio/branches/developers/jcorgan/cppwrap/gnuradio-core/src/lib/runtime/gr_basic_flowgraph.h
Log:
Work in progres. Improved conditional debugging.
Modified:
gnuradio/branches/developers/jcorgan/cppwrap/gnuradio-core/src/lib/runtime/gr_basic_flowgraph.cc
===================================================================
---
gnuradio/branches/developers/jcorgan/cppwrap/gnuradio-core/src/lib/runtime/gr_basic_flowgraph.cc
2006-10-26 08:56:49 UTC (rev 3859)
+++
gnuradio/branches/developers/jcorgan/cppwrap/gnuradio-core/src/lib/runtime/gr_basic_flowgraph.cc
2006-10-26 18:12:11 UTC (rev 3860)
@@ -25,10 +25,7 @@
#include <gr_buffer.h>
#include <algorithm>
-
-#if GR_FLOWGRAPH_DEBUG
#include <iostream>
-#endif
using namespace std;
@@ -38,19 +35,17 @@
// allocated on the heap. No further memory management is needed.
gr_basic_flowgraph_sptr gr_make_basic_flowgraph()
{
-#if GR_FLOWGRAPH_DEBUG
- cout << "Flowgraph constructed." << endl;
-#endif
+ if (GR_FLOWGRAPH_DEBUG)
+ cout << "Flowgraph constructed." << endl;
+
return gr_basic_flowgraph_sptr(new gr_basic_flowgraph());
}
// Destructor, nothing to do.
gr_basic_flowgraph::~gr_basic_flowgraph()
{
-#if GR_FLOWGRAPH_DEBUG
- cout << "Flowgraph destructed." << endl;
-#endif
- // NOP
+ if (GR_FLOWGRAPH_DEBUG)
+ cout << "Flowgraph destructed." << endl;
}
// Establishes a connection between supplied blocks and ports
@@ -74,9 +69,9 @@
void gr_basic_flowgraph::disconnect_all()
{
d_edges.clear();
-#if GR_FLOWGRAPH_DEBUG
- cout << "Disconnected all blocks." << endl;
-#endif
+
+ if (GR_FLOWGRAPH_DEBUG)
+ cout << "Disconnected all blocks." << endl;
}
// validates flowgraph toplogy and finalizes internal structures
@@ -142,14 +137,13 @@
// Create edge instance and add to edge list
d_edges.push_back(gr_edge_t(src, dst));
-#if GR_FLOWGRAPH_DEBUG
- cout << "Connected " << src.first << ":" << src.second << " to "
- << dst.second << ":" << dst.first << endl;
-#endif
+ if (GR_FLOWGRAPH_DEBUG)
+ cout << "Connected " << src.first << ":" << src.second << " to "
+ << dst.second << ":" << dst.first << endl;
}
// Removes an edge from the list of edges. All overloaded version sof
'disconnect'
-// shoudl resolve to calls here.
+// should resolve to calls here.
void gr_basic_flowgraph::disconnect_prim(gr_endpoint_t src, gr_endpoint_t dst)
{
gr_edge_vector_iterator_t edge_iter;
@@ -158,10 +152,9 @@
d_edges.erase(edge_iter);
else
throw invalid_argument("gr_basic_flowgraph::disconnect_prim: not
connected");
-#if GR_FLOWGRAPH_DEBUG
- cout << "Disconnected " << src.first << ":" << src.second << " from "
- << dst.second << ":" << dst.first << endl;
-#endif
+ if (GR_FLOWGRAPH_DEBUG)
+ cout << "Disconnected " << src.first << ":" << src.second << " from "
+ << dst.second << ":" << dst.first << endl;
}
// Ports must not be negative and must be less than max streams for block
@@ -216,9 +209,9 @@
if (block_iter == d_blocks.end())
d_blocks.push_back(dst_block);
}
-#if GR_FLOWGRAPH_DEBUG
- cout << "Flow graph has " << d_blocks.size() << " unique blocks." << endl;
-#endif
+
+ if (GR_FLOWGRAPH_DEBUG)
+ cout << "Flow graph has " << d_blocks.size() << " unique blocks." <<
endl;
}
// Based on connectivity, create block details, buffers, and assign to block
outputs
@@ -232,10 +225,9 @@
int ninputs = used_inputs.size();
int noutputs = used_outputs.size();
-#if GR_FLOWGRAPH_DEBUG
- cout << "Checking correctness for " << (*block_iter)
- << " with " << ninputs << " inputs and " << noutputs << "
outputs." << endl;
-#endif
+ if (GR_FLOWGRAPH_DEBUG)
+ cout << "Checking correctness for " << (*block_iter)
+ << " with " << ninputs << " inputs and " << noutputs << "
outputs." << endl;
// Blocks must have inputs sequentially assigned with no gaps
check_contiguity(*block_iter, (*block_iter)->input_signature(),
used_inputs);
@@ -267,10 +259,11 @@
int src_port = edge_iter->first.second;
gr_block_sptr src_block = edge_iter->first.first;
gr_buffer_sptr src_buffer = src_block->detail()->output(src_port);
-#if GR_FLOWGRAPH_DEBUG
- cout << "Setting input buffer on " << dst_port << ":"
- << edge_iter->second.first << endl;
-#endif
+
+ if (GR_FLOWGRAPH_DEBUG)
+ cout << "Setting input buffer on " << dst_port << ":"
+ << edge_iter->second.first << endl;
+
detail->set_input(dst_port, gr_buffer_add_reader(src_buffer,
(*block_iter)->history()-1));
}
}
@@ -297,10 +290,11 @@
int history = (*block_iter)->history();
nitems = max(nitems, 2*(decimation*multiple+history));
}
-#if GR_FLOWGRAPH_DEBUG
- cout << "Block " << block << " has output buffer of " << nitems
- << " items, each of size " << item_size << endl;
-#endif
+
+ if (GR_FLOWGRAPH_DEBUG)
+ cout << "Block " << block << " has output buffer of " << nitems
+ << " items, each of size " << item_size << endl;
+
return gr_make_buffer(nitems, item_size);
}
@@ -356,25 +350,23 @@
return;
else
{
-#if GR_FLOWGRAPH_DEBUG
- cout << "Used ports = " << l << ", min_streams = " << min_s << endl;
-#endif
+ if (GR_FLOWGRAPH_DEBUG)
+ cout << "Used ports = " << l << ", min_streams = " << min_s <<
endl;
throw invalid_argument("gr_basic_flowgraph::check_contiguity:
insufficient connections");
}
}
-#if GR_FLOWGRAPH_DEBUG
- cout << "Checking contiguity of block " << block << " with " << l << "
used ports." << endl;
-#endif
+ if (GR_FLOWGRAPH_DEBUG)
+ cout << "Checking contiguity of block " << block << " with " << l << "
used ports." << endl;
if (used_ports[l-1]+1 < min_s)
throw invalid_argument("gr_basic_flowgraph::check_contiguity:
insufficient inputs");
if (used_ports[l-1]+1 != l) {
for (int i = 0; i < l; i++) {
-#if GR_FLOWGRAPH_DEBUG
- cout << "Port " << i << " = " << used_ports[i] << endl;
-#endif
+ if (GR_FLOWGRAPH_DEBUG)
+ cout << "Port " << i << " = " << used_ports[i] << endl;
+
if (used_ports[i] != i)
throw invalid_argument("gr_basic_flowgraph::check_contiguity:
missing input");
}
Modified:
gnuradio/branches/developers/jcorgan/cppwrap/gnuradio-core/src/lib/runtime/gr_basic_flowgraph.h
===================================================================
---
gnuradio/branches/developers/jcorgan/cppwrap/gnuradio-core/src/lib/runtime/gr_basic_flowgraph.h
2006-10-26 08:56:49 UTC (rev 3859)
+++
gnuradio/branches/developers/jcorgan/cppwrap/gnuradio-core/src/lib/runtime/gr_basic_flowgraph.h
2006-10-26 18:12:11 UTC (rev 3860)
@@ -29,7 +29,7 @@
// and is not exported via SWIG. This is only used when writing pure C++
programs.
// Define to 0 to eliminate flowgraph debugging
-#define GR_FLOWGRAPH_DEBUG 1
+#define GR_FLOWGRAPH_DEBUG 0
#include <gr_block.h>
#include <boost/enable_shared_from_this.hpp>
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Commit-gnuradio] r3860 - gnuradio/branches/developers/jcorgan/cppwrap/gnuradio-core/src/lib/runtime,
jcorgan <=