Boost logo

Boost :

Subject: Re: [boost] Flow-based programming library for Boost?
From: Vicente J. Botet Escriba (vicente.botet_at_[hidden])
Date: 2013-01-02 19:38:20

Le 05/12/12 13:31, Marcus Tomlinson a écrit :
> Is there any interest out there for a library that allows you to create
> fast, efficient flow-based programs with an easy-to-use object-oriented
> interface? (
> I've created an open-source library that does this, called "DSPatch" (
> and would like to contribute it to
> the Boost Libraries.
> Please let me know if this sounds like something you'd like to see in Boost.

I have some questions about your design:

* You use a bus of input/output untyped signals. Why the signals are not
* Why do you need that the process function be virtual?

I have tried to rewrite your example with something that could be more
inline with the suggestion from Dave

// 1. Derive component class from DspComponent
// ===========================================
class DspAnd : public DspComponent<DspAnd, InPort<bool>,InPort<bool>,
typedef DspComponent<DspAnd, InPort<bool>,InPort<bool>, OutPort<bool>>
// 2. Configure component IO buses
// ===============================
DspAnd(DspComponentBase& parent, Signal<bool>& x, Signal<bool>& y,
Signal<bool>& o)
: base_type(parent, x, y, o)
// 3. Implement a non-virtual operator() method
// ======================================
bool operator()(bool x, bool y)
   return x && y;
void main()
// 1. Create a DspCircuit where we can route our components
// ========================================================
DspCircuit circuit;
// 2. Create the internal signals
DspSignal<bool> i1, i2, o;
// ========================================================
// 3. Create instances of the components needed for our circuit and
connect the signals and the ports
// ============================================================
DspRandBool randBoolGen1(circuit, i1);
DspRandBool randBoolGen2(circuit, i2);
DspAnd logicAnd(circuit, i1,i2,o);
DspPrintBool boolPrinter(circuit, o);

Note that the each signal has a specific type, each component has typed
ports that are used to wire the circuit/network, the operator() is not
virtual (use of CRTP) and the connections are done at construction.
Components with several outputs should define a operator() returning the
tuple of outputs.

Do you think that this refactoring could improve your library?


Boost list run by bdawes at, gregod at, cpdaniel at, john at