diff options
| author | Tim Redfern <tim@eclectronics.org> | 2014-05-23 09:45:50 +0100 |
|---|---|---|
| committer | Tim Redfern <tim@eclectronics.org> | 2014-05-23 09:45:50 +0100 |
| commit | fc9b92ea1ab78e8f8b441cef2416eb73472ff106 (patch) | |
| tree | 213ffbe1f2686b7c05ae54956c5e60522d9d9ffe /NT/src/rotor.h | |
| parent | 8f1667713a961de1f20688470ab84db097151692 (diff) | |
variable type getter/setter
Diffstat (limited to 'NT/src/rotor.h')
| -rw-r--r-- | NT/src/rotor.h | 42 |
1 files changed, 42 insertions, 0 deletions
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 NT> 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<std::string,Node*> &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<double> Number_node; + typedef Node_type<string> String_node; + typedef Node_type<Image> Image_node; + + typedef Variable_type<double> Number_inlet; + typedef Variable_type<string> String_inlet; + typedef Variable_type<Image> Image_inlet; + + typedef Variable_array_type<double> Number_array; + typedef Variable_array_type<string> String_array; + typedef Variable_array_type<Image> Image_array; } #endif //ROTOR_H |
