summaryrefslogtreecommitdiff
path: root/rotord/src/rotor.h
diff options
context:
space:
mode:
Diffstat (limited to 'rotord/src/rotor.h')
-rwxr-xr-xrotord/src/rotor.h138
1 files changed, 75 insertions, 63 deletions
diff --git a/rotord/src/rotor.h b/rotord/src/rotor.h
index 84a42e3..67445e9 100755
--- a/rotord/src/rotor.h
+++ b/rotord/src/rotor.h
@@ -873,74 +873,86 @@ namespace Rotor {
}
return NULL;
};
- void list_nodes(xmlIO XML){
- int i=0;
- for (auto& type: type_map) { //c++11
- if (type.second->description!="") { //blank description = internal/ testing node
- XML.addTag("node");
- XML.addAttribute("node","type",type.first,i);
- XML.addAttribute("node","inputs",type.second->duplicate_inputs?"expandable":"fixed",i);
- XML.addAttribute("node","title",type.second->title,i);
- XML.addAttribute("node","description",type.second->description,i);
- if (dynamic_cast<Signal_node*> (type.second)!=nullptr) XML.addAttribute("node","output","signal",i);
- if (dynamic_cast<Image_node*> (type.second)!=nullptr) XML.addAttribute("node","output","image",i);
- XML.pushTag("node",i);
- //if (type.second->description!="") {
- // XML.addTag("description");
- // XML.setValue("description",type.second->description,0);
- //}
- int j=0;
- for (auto& input: type.second->inputs) {
- XML.addTag("signal_input");
- XML.addAttribute("signal_input","title",input->title,j);
- XML.addAttribute("signal_input","description",input->description,j);
- j++;
- }
- j=0;
- if (dynamic_cast<Image_node*> (type.second)!=nullptr) {
- for (auto& input: (dynamic_cast<Image_node*>(type.second))->image_inputs) {
- XML.addTag("image_input");
- XML.addAttribute("image_input","title",input->title,j);
- XML.addAttribute("image_input","description",input->description,j);
- j++;
- }
- }
- j=0;
- for (auto& parameter: type.second->parameters) {
- XML.addTag("parameter");
- XML.addAttribute("parameter","name",parameter.first,j);
- XML.addAttribute("parameter","type",parameter.second->type,j);
- XML.addAttribute("parameter","title",parameter.second->title,j);
- XML.addAttribute("parameter","description",parameter.second->description,j);
- XML.addAttribute("parameter","value",parameter.second->value,j);
- XML.addAttribute("parameter","min",parameter.second->min,j);
- XML.addAttribute("parameter","max",parameter.second->max,j);
+ bool list_node(const string &t,xmlIO XML){
+ for (auto& type: type_map) {
+ if (type.first==t) {
+ list_node(type,XML);
+ return true;
+ }
+ }
+ XML.addValue("error","Node /"+t+"/ not found");
+ };
+ void list_node(std::pair<const std::basic_string<char>, Rotor::Node*> &type,xmlIO XML,int i=0){
+ if (type.second->description!="") { //blank description = internal/ testing node
+ XML.addTag("node");
+ XML.addAttribute("node","type",type.first,i);
+ XML.addAttribute("node","inputs",type.second->duplicate_inputs?"expandable":"fixed",i);
+ XML.addAttribute("node","title",type.second->title,i);
+ XML.addAttribute("node","description",type.second->description,i);
+ if (dynamic_cast<Signal_node*> (type.second)!=nullptr) XML.addAttribute("node","output","signal",i);
+ if (dynamic_cast<Image_node*> (type.second)!=nullptr) XML.addAttribute("node","output","image",i);
+ XML.pushTag("node",i);
+ //if (type.second->description!="") {
+ // XML.addTag("description");
+ // XML.setValue("description",type.second->description,0);
+ //}
+ int j=0;
+ for (auto& input: type.second->inputs) {
+ XML.addTag("signal_input");
+ XML.addAttribute("signal_input","title",input->title,j);
+ XML.addAttribute("signal_input","description",input->description,j);
+ j++;
+ }
+ j=0;
+ if (dynamic_cast<Image_node*> (type.second)!=nullptr) {
+ for (auto& input: (dynamic_cast<Image_node*>(type.second))->image_inputs) {
+ XML.addTag("image_input");
+ XML.addAttribute("image_input","title",input->title,j);
+ XML.addAttribute("image_input","description",input->description,j);
j++;
}
- j=0;
- for (auto& attribute: type.second->attributes) {
- XML.addTag("attribute");
- XML.addAttribute("attribute","name",attribute.first,j);
- XML.addAttribute("attribute","title",attribute.second->title,j);
- XML.addAttribute("attribute","description",attribute.second->description,j);
- XML.addAttribute("attribute","value",attribute.second->value,j);
- if (attribute.second->vals.size()){ //document attribute enumeration
- XML.addAttribute("attribute","type","enum",j);
- XML.pushTag("attribute",j);
- int k=0;
- for (auto val: attribute.second->vals){
- XML.addTag("option");
- XML.addAttribute("option","value",val,k);
- k++;
- }
- XML.popTag();
+ }
+ j=0;
+ for (auto& parameter: type.second->parameters) {
+ XML.addTag("parameter");
+ XML.addAttribute("parameter","name",parameter.first,j);
+ XML.addAttribute("parameter","type",parameter.second->type,j);
+ XML.addAttribute("parameter","title",parameter.second->title,j);
+ XML.addAttribute("parameter","description",parameter.second->description,j);
+ XML.addAttribute("parameter","value",parameter.second->value,j);
+ XML.addAttribute("parameter","min",parameter.second->min,j);
+ XML.addAttribute("parameter","max",parameter.second->max,j);
+ j++;
+ }
+ j=0;
+ for (auto& attribute: type.second->attributes) {
+ XML.addTag("attribute");
+ XML.addAttribute("attribute","name",attribute.first,j);
+ XML.addAttribute("attribute","title",attribute.second->title,j);
+ XML.addAttribute("attribute","description",attribute.second->description,j);
+ XML.addAttribute("attribute","value",attribute.second->value,j);
+ if (attribute.second->vals.size()){ //document attribute enumeration
+ XML.addAttribute("attribute","type","enum",j);
+ XML.pushTag("attribute",j);
+ int k=0;
+ for (auto val: attribute.second->vals){
+ XML.addTag("option");
+ XML.addAttribute("option","value",val,k);
+ k++;
}
- else XML.addAttribute("attribute","type","string",j);
- j++;
+ XML.popTag();
}
- XML.popTag();
- i++;
+ else XML.addAttribute("attribute","type","string",j);
+ j++;
}
+ XML.popTag();
+ }
+ }
+ void list_nodes(xmlIO XML){
+ int i=0;
+ for (auto& type: type_map) { //c++11
+ list_node(type,XML,i);
+ i++;
}
}
private: