00001
00002
00003
00004
00005
00006
00007
00008
00009 #ifndef INSTIGATE_GEOMETRY_CONCEPT_RECTANGLE
00010 #define INSTIGATE_GEOMETRY_CONCEPT_RECTANGLE
00011
00025
00026
00027
00028 #include <stl/concept.hpp>
00029
00030
00031
00032
00033
00034
00035 namespace instigate {
00036 namespace geometry {
00037 namespace concept {
00045 namespace rectangle {
00046 template<typename T>
00047 class interface;
00048 template<typename T>
00049 class requirements;
00050 }
00051 }
00052 }
00053 }
00054
00075 template <typename T>
00076 struct instigate::geometry::concept::rectangle::interface
00077 : public instigate::default_constructible::interface<T>
00078 , public instigate::assignable::interface<T>
00079 {
00081 public:
00087 typedef typename T::coordinate_type coordinate_type;
00088 public:
00089
00109 static void set_left(T& p, const coordinate_type& v)
00110 {
00111 p.set_left(v);
00112 }
00113
00133 static void set_bottom(T& p, const coordinate_type& v)
00134 {
00135 p.set_bottom(v);
00136 }
00137
00157 static void set_right(T& p, const coordinate_type& v)
00158 {
00159 p.set_right(v);
00160 }
00161
00181 static void set_top(T& p, const coordinate_type& v)
00182 {
00183 p.set_top(v);
00184 }
00185
00193 static const coordinate_type get_left(const T& p)
00194 {
00195 return p.get_left();
00196 }
00197
00205 static const coordinate_type get_bottom(const T& p)
00206 {
00207 return p.get_bottom();
00208 }
00209
00217 static const coordinate_type get_right(const T& p)
00218 {
00219 return p.get_right();
00220 }
00221
00229 static const coordinate_type get_top(const T& p)
00230 {
00231 return p.get_top();
00232 }
00233
00234
00235 };
00236
00244 template <typename T>
00245 struct instigate::geometry::concept::rectangle::requirements
00246 : public instigate::default_constructible::requirements<T>
00247 , public instigate::assignable::requirements<T>
00248 {
00249
00250 void require_nested_typenames()
00251 {
00252 namespace G = instigate::geometry;
00253 typedef G::concept::rectangle::interface<T> RC;
00254 typedef typename RC::coordinate_type C;
00255 }
00256
00257 void require_set_functions(T& p,
00258 typename instigate::geometry::
00259 concept::rectangle::interface<T>::coordinate_type a)
00260 {
00261 namespace G = instigate::geometry;
00262 typedef G::concept::rectangle::interface<T> RC;
00263 RC::set_top(p, a);
00264 RC::set_left(p, a);
00265 RC::set_bottom(p, a);
00266 RC::set_right(p, a);
00267 }
00268
00269
00270 typename instigate::geometry::concept::rectangle::
00271 interface<T>::coordinate_type
00272 require_get_right_function(const T& p)
00273 {
00274 namespace C = instigate::geometry::concept;
00275 typedef C::rectangle::interface<T> RC;
00276 return RC::get_right(p);
00277 }
00278
00279 typename instigate::geometry::concept::rectangle::
00280 interface<T>::coordinate_type
00281 require_get_top_function(const T& p)
00282 {
00283 namespace C = instigate::geometry::concept;
00284 typedef C::rectangle::interface<T> RC;
00285 return RC::get_top(p);
00286 }
00287
00288 typename instigate::geometry::concept::rectangle::
00289 interface<T>::coordinate_type
00290 require_get_left_function(const T& p)
00291 {
00292 namespace C = instigate::geometry::concept;
00293 typedef C::rectangle::interface<T> RC;
00294 return RC::get_left(p);
00295 }
00296
00297 typename instigate::geometry::concept::rectangle::
00298 interface<T>::coordinate_type
00299 require_get_bottom_function(const T& p)
00300 {
00301 namespace C = instigate::geometry::concept;
00302 typedef C::rectangle::interface<T> RC;
00303 return RC::get_bottom(p);
00304 }
00305
00306 requirements()
00307 {
00308 (void)&requirements<T>::require_nested_typenames;
00309 (void)&requirements<T>::require_set_functions;
00310 (void)&requirements<T>::require_get_right_function;
00311 (void)&requirements<T>::require_get_top_function;
00312 (void)&requirements<T>::require_get_left_function;
00313 (void)&requirements<T>::require_get_bottom_function;
00314 }
00315
00316 };
00317
00318
00319
00320 #endif // INSTIGATE_GEOMETRY_CONCEPT_RECTANGLE
00321