summaryrefslogtreecommitdiff
path: root/NT/src
diff options
context:
space:
mode:
Diffstat (limited to 'NT/src')
-rw-r--r--NT/src/rotor.cpp7
-rw-r--r--NT/src/rotor.h68
2 files changed, 75 insertions, 0 deletions
diff --git a/NT/src/rotor.cpp b/NT/src/rotor.cpp
new file mode 100644
index 0000000..2678dd5
--- /dev/null
+++ b/NT/src/rotor.cpp
@@ -0,0 +1,7 @@
+#include <stdio.h>
+
+#include "rotor.h"
+
+int main(){
+ printf("hello, world\n");
+} \ No newline at end of file
diff --git a/NT/src/rotor.h b/NT/src/rotor.h
new file mode 100644
index 0000000..6835d01
--- /dev/null
+++ b/NT/src/rotor.h
@@ -0,0 +1,68 @@
+#include <string>
+#include <map>
+#include <unordered_map>
+
+namespace Rotor {
+
+ class Node;
+ class Frame_parameters;
+
+ class Variable { //base type for variable pointers
+ public:
+ virtual void init(std::string s){};
+ virtual ~Variable(){};
+ };
+ template <class T> class Variable_type : public Variable {
+ public:
+ Node* connection;
+ T* get(Frame_parameters frame);
+ bool connectable;
+ T value;
+ };
+ //type specialisations deal with string conversion
+
+
+ //what happens if we want to link an unlinked attribute at runtime
+ //should attributes and paramaters just be the same thing
+ //it would be really nice if there could be arithmetic
+ //type objects that could act on multiple types
+
+ //either we call them attributes and inlets or just vars
+ //for the author, is it better to have seperate static members?
+ //for the GUI, yes. but is that another issue?
+ //does the gui need a hint for the "basic" mode inlets so they stand out?
+
+ class Node { //base type for node pointers
+ };
+ template <class NT> class Node_type : public Node {
+ public:
+ std::unordered_map<std::string,Variable*> vars;
+ NT* get_output(Frame_parameters frame);
+ virtual ~Node_type(){
+ for (auto v:vars){
+ delete v.second;
+ }
+ }
+ void init(std::map<std::string,std::string> settings){
+ for (auto s:settings) {
+ if (vars.find(s.first)){
+ vars[s.first]->init(s.second);
+ }
+ }
+ }
+ template <class IT> IT* create_inlet(std::string name){
+ vars[name]=new Variable_type<IT>();
+ return &((dynamic_cast<Variable_type<IT>*>(vars[name]))->value);
+ }
+ };
+
+ class a_node: public Node_type<double> {
+ a_node(){
+ delay=create_inlet<int>("delay");
+ //initialise the pointer to point at the instance variable
+ //how to delete the vars ???
+ };
+ int *delay;
+ };
+
+}