1 #ifndef color__internal_utility_container_boolean 2 #define color__internal_utility_container_boolean 3 4 // ::color::_internal::utility::container::boolean< index_name > 5 6 #include "../type/index.hpp" 7 #include "../type/size.hpp" 8 #include "../type/traitp.hpp" 9 10 11 12 namespace color 13 { 14 namespace _internal 15 { 16 namespace utility 17 { 18 namespace container 19 { 20 21 template< typename index_name/* pointless */ > 22 struct boolean 23 { 24 public: 25 typedef index_name index_type; 26 typedef bool value_type; 27 28 typedef ::color::_internal::utility::container::boolean< index_name > this_type; 29 30 typedef bool instance_type; 31 32 33 34 typedef instance_type const const_type; 35 typedef instance_type const& return_image_type; 36 typedef instance_type & return_type; 37 typedef instance_type & return_original_type; 38 typedef instance_type const& model_type; 39 typedef instance_type & input_type; 40 typedef instance_type & output_type; 41 42 typedef ::color::_internal::utility::type::index< index_type > index_trait_type; 43 44 typedef typename index_trait_type::instance_type index_instance_type; 45 46 typedef typename index_trait_type::model_type index_input_const_type; 47 typedef typename index_trait_type::return_image_type index_return_image_type; 48 49 typedef ::color::_internal::utility::type::traitC< value_type > component_trait_type; 50 51 typedef typename component_trait_type::instance_type component_type; 52 53 typedef typename component_trait_type::return_image_type component_return_const_type; 54 typedef typename component_trait_type::model_type component_input_const_type; 55 56 typedef ::color::_internal::utility::type::size< std::size_t > size_trait_type; 57 58 typedef typename size_trait_type::return_image_type size_return_image_type; 59 typedef typename size_trait_type::instance_type size_instance_type; 60 61 62 typedef void set_return_type; 63 64 enum { size_entity = 1 }; 65 66 initcolor::_internal::utility::container::boolean67 static set_return_type init( input_type container, index_input_const_type index, component_input_const_type value ) 68 { 69 this_type::set( container, index, value ); 70 } 71 72 template< index_instance_type index > initcolor::_internal::utility::container::boolean73 static set_return_type init( input_type container, component_input_const_type value ) 74 { 75 this_type:: template set<index>( container, value ); 76 } 77 getcolor::_internal::utility::container::boolean78 static component_return_const_type get( model_type container, index_input_const_type index ) 79 { 80 return container; 81 } 82 83 template< index_instance_type index > getcolor::_internal::utility::container::boolean84 static component_return_const_type get( model_type container ) 85 { 86 //TODO C++14 static_assert( index < 1, "Index is out of range." ); 87 return container; 88 } 89 setcolor::_internal::utility::container::boolean90 static set_return_type set( input_type container, index_input_const_type index, component_input_const_type value ) 91 { 92 container = value; 93 } 94 95 template< index_instance_type index > setcolor::_internal::utility::container::boolean96 static set_return_type set( input_type container, component_input_const_type value ) 97 { 98 //TODO C++14 static_assert( index < 1, "Index is out of range." ); 99 container = value; 100 } 101 sizecolor::_internal::utility::container::boolean102 static /*constexpr*/ size_return_image_type size() 103 { 104 static const size_instance_type local_length = size_entity; 105 return local_length; 106 } 107 }; 108 } 109 } 110 } 111 } 112 113 #endif