Geant4 Cross Reference |
1 // Copyright (C) 2010, Guy Barrand. All rights reserved. 2 // See the file tools.license for terms. 3 4 #ifndef tools_sg_style_color 5 #define tools_sg_style_color 6 7 #include "../colorf" 8 9 #ifdef TOOLS_MEM 10 #include "../mem" 11 #include "../S_STRING" 12 #endif 13 14 namespace tools { 15 namespace sg { 16 17 class style_color : public std::pair<std::string,colorf> { 18 typedef std::pair<std::string,colorf> parent; 19 #ifdef TOOLS_MEM 20 TOOLS_SCLASS(tools::sg::style_color) 21 #endif 22 public: 23 style_color():parent("",colorf()) { 24 #ifdef TOOLS_MEM 25 mem::increment(s_class().c_str()); 26 #endif 27 } 28 style_color(const std::string& a_name,const colorf& a_color):parent(a_name,a_color) { 29 #ifdef TOOLS_MEM 30 mem::increment(s_class().c_str()); 31 #endif 32 } 33 style_color(const std::string& a_name,float a_r,float a_g,float a_b):parent(a_name,colorf(a_r,a_g,a_b)) { 34 #ifdef TOOLS_MEM 35 mem::increment(s_class().c_str()); 36 #endif 37 } 38 virtual ~style_color(){ 39 #ifdef TOOLS_MEM 40 mem::decrement(s_class().c_str()); 41 #endif 42 } 43 public: 44 style_color(const style_color& a_from):parent(a_from.first,a_from.second) { 45 #ifdef TOOLS_MEM 46 mem::increment(s_class().c_str()); 47 #endif 48 } 49 style_color& operator=(const style_color& a_from){ 50 first = a_from.first; 51 second = a_from.second; 52 return *this; 53 } 54 public: 55 void set_name(const std::string& a_name) {first = a_name;} 56 void set_value(float a_r,float a_g,float a_b,float a_a) {second.set_value(a_r,a_g,a_b,a_a);} 57 }; 58 59 }} 60 61 #endif 62 63 64