blob: 86b6a48c0a9b68cb05b29db2d979d0e74fba0670 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
#include "factory.h"
using namespace Rotor;
Node_factory::Node_factory(){
//for now, statically load prototype map in constructor
add_type(new Time(),"nodes");
add_type(new Multiply(),"nodes");
add_type(new Print(),"nodes");
}
bool Node_factory::list_node(const string &_type,Json::Value &json){
for (auto& type: type_map) {
cerr<<type.first<<endl;
if (type.first==_type) {
json["node"]=type.second->to_json();
return true;
}
}
json["error"]="Node '"+_type+"' not found";
return false;
};
|