0

I have a local system which is written by C++.

I want to integrate noflo with my system,so I want to write a component(by C++) to fetch data from my system to noflo,and write another component(by C++) to provide data from noflo to my system.

Matt
  • 14,906
  • 27
  • 99
  • 149
Fancy Max
  • 43
  • 7
  • I want to write a component by C++ to integrate into noflo, I know how to write it by coffeescript,but i can't find a way to write it by C++ – Fancy Max Jan 15 '16 at 01:10

2 Answers2

1

You cannot directly write a NoFlo component in C++, as NoFlo is a JavaScript library.

If you are using NoFlo on Node.js, you can create a node.js C++ addon, and then use the JS API in your NoFlo component. If you are using NoFlo on browser, you can use Emscripten to compile your C++ into JS.

Other mechanisms of communicating from a NoFlo program with C++ code include:

  • Running the C++ code as a subprocess, and communicate over stdin/stdout. See gmr-saliency example.
  • Communicate between NoFlo and your system using a standard message broker like AMQP or MQTT. MsgFlo and msgflo-cpp is designed created to help with that. Recommended for distributed systems.
  • Implementing the FBP runtime protocol and using noflo-runtime/RemoteSubgraph to communicate with it. Documentation currently missing
Jon Nordby
  • 5,494
  • 1
  • 21
  • 50
0

Yes you can, have a look at the C++ implementation of the FBP protocol:

https://github.com/microflo/microflo

thoaionline
  • 518
  • 2
  • 5
  • 14
  • microflo is a flow engine like noflo which is used inside a microController.But I want to write a component by C++ to integrate into noflo, I know how to write it by coffeescript,but i can't find a way to write it by C++ – Fancy Max Jan 15 '16 at 01:07
  • Is the rest of your application written in NodeJS? – thoaionline Jan 16 '16 at 03:04
  • the rest of my application written in C++ and C# – Fancy Max Jan 18 '16 at 00:50
  • In that case, you can build and embed the (flow) bootstraper as part of your application, and call it from within your application as a function. The bootstrapper is the piece of code that initiate and run your graph. When you're writing a pure FBP application, it takes the form of the main method. If you want to have a flow-based component in a legacy application, you'll need to write your own bootstrapper, which build a graph, take the input (function parameter) and feed it into the graph, then return the output. Hope this make sense. – thoaionline Jan 23 '16 at 06:19
  • Maybe I should use csharpfbp instead of noflo – Fancy Max Jan 23 '16 at 08:35