From fc9b92ea1ab78e8f8b441cef2416eb73472ff106 Mon Sep 17 00:00:00 2001 From: Tim Redfern Date: Fri, 23 May 2014 09:45:50 +0100 Subject: variable type getter/setter --- NT/src/rotor.h | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) (limited to 'NT/src/rotor.h') diff --git a/NT/src/rotor.h b/NT/src/rotor.h index 59533f5..6ed3b67 100644 --- a/NT/src/rotor.h +++ b/NT/src/rotor.h @@ -90,6 +90,33 @@ namespace Rotor { class Node; template class Node_type; + class Colour{ + public: + Colour(){ + r=g=b=0; + } + Colour(int c){ + r=c&0xFF; + g=(c&0xFF00)>>8; + b=(c&0xFF0000)>>16; + } + Colour(std::string s){ + r=(uint8_t)hexToChar(s.substr(0,2)); + g=(uint8_t)hexToChar(s.substr(2,2)); + b=(uint8_t)hexToChar(s.substr(4,2)); + } + double Rdouble(){ + return ((double)r)/255.0; + } + double Gdouble(){ + return ((double)g)/255.0; + } + double Bdouble(){ + return ((double)b)/255.0; + } + uint8_t r,g,b; + }; + class Enum{ //enumerated string type for node options that can appear in a menu public: @@ -215,6 +242,9 @@ namespace Rotor { void set(const T& val){ value=val; } + const T& get(){ + return value; + } bool create_connection(std::unordered_map &nodes){ for (auto node:nodes){ if (node.first==input){ @@ -360,6 +390,18 @@ namespace Rotor { protected: NT result; //internal value is returned as a reference }; + + typedef Node_type Number_node; + typedef Node_type String_node; + typedef Node_type Image_node; + + typedef Variable_type Number_inlet; + typedef Variable_type String_inlet; + typedef Variable_type Image_inlet; + + typedef Variable_array_type Number_array; + typedef Variable_array_type String_array; + typedef Variable_array_type Image_array; } #endif //ROTOR_H -- cgit v1.2.3