Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/retejs/cpp-engine
Cross-platform implementation of the Engine for D3NE
https://github.com/retejs/cpp-engine
Last synced: 10 days ago
JSON representation
Cross-platform implementation of the Engine for D3NE
- Host: GitHub
- URL: https://github.com/retejs/cpp-engine
- Owner: retejs
- Created: 2017-08-14T19:48:01.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2017-08-17T10:44:25.000Z (over 7 years ago)
- Last Synced: 2024-10-30T00:54:48.791Z (21 days ago)
- Language: C++
- Homepage:
- Size: 11.7 KB
- Stars: 26
- Watchers: 4
- Forks: 4
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
D3 Node Engine
====
#### Cross-platform implementation of the Engine for [D3 Node Editor](https://github.com/Ni55aN/D3-Node-Editor)### Usage
Library is header-only, so it's enought to include "D3NE.h"
```cpp
#include "D3NE.h"using namespace D3NE;
```
Define workers
```cpp
Workers workers;workers.put("number", [](Node node, InputData inputs, OutputData &outputs) {
auto num = node.data.get()["num"].get();
outputs[0].reset(new int(num));
});workers.put("add", [](D3NE::Node node, InputData inputs, OutputData &outputs) {
auto inp1 = inputs[0][0].get();
auto inp2 = inputs[1][0].get();outputs[0].reset(new int(inp1 + inp2));
printf("Add result: %s\n", to_string(inp1 + inp2).c_str());
});
```Declare Engine and pass [JSON string](https://github.com/Ni55aN/D3-Node-Engine/tree/master/src) for processing
```cpp
Engine *engine = new Engine("[email protected]", workers);string json = ...;
JSON data;
data.from(json);engine->process(data);
```License
----
MIT