Instigate Open Source Documentation

instigate::geometry::concept::rectangle::interface< T > Struct Template Reference

Interface for the concept Rectangle Concept. More...

#include <concept_rectangle.hpp>

Inheritance diagram for instigate::geometry::concept::rectangle::interface< T >:
instigate::default_constructible::interface< T > instigate::assignable::interface< T >

List of all members.

Coordinates



typedef T::coordinate_type coordinate_type
 Typename for the coordinate type.
static void set_left (T &p, const coordinate_type &v)
 Sets the left coordinate (x1) of the rectangle.
static void set_bottom (T &p, const coordinate_type &v)
 Sets the bottom coordinate (y1) of the rectangle.
static void set_right (T &p, const coordinate_type &v)
 Sets the right coordinate (x2) of the rectangle.
static void set_top (T &p, const coordinate_type &v)
 Sets the top coordinate of the rectangle.
static const coordinate_type get_left (const T &p)
 Returns the left coordinate (x1) of the rectangle.
static const coordinate_type get_bottom (const T &p)
 Returns the bottom coordinate (y1) of the rectangle.
static const coordinate_type get_right (const T &p)
 Returns the right coordinate (x2) of the rectangle.
static const coordinate_type get_top (const T &p)
 Returns top coordinate (y2) of the rectangle.

Detailed Description

template<typename T>
struct instigate::geometry::concept::rectangle::interface< T >

Interface for the concept Rectangle Concept.

This is a "non-intrusive" interface for the rectangle. Any type, that conceptually can be treated as a rectangle can become a model of this concept, if this interface is provided for it by specializing this template structure with that type and providing definitions for associated types and basic operations.

Refinement of:
Models:

Member Typedef Documentation

template<typename T>
typedef T::coordinate_type instigate::geometry::concept::rectangle::interface< T >::coordinate_type

Typename for the coordinate type.

This must be a numeric type.


Member Function Documentation

template<typename T>
static const coordinate_type instigate::geometry::concept::rectangle::interface< T >::get_bottom ( const T &  p  )  [inline, static]

Returns the bottom coordinate (y1) of the rectangle.

Parameters:
p - an object of type T
Postcondition:
get_bottom(p) <= get_top(p)
template<typename T>
static const coordinate_type instigate::geometry::concept::rectangle::interface< T >::get_left ( const T &  p  )  [inline, static]

Returns the left coordinate (x1) of the rectangle.

Parameters:
p - an object of type T
Postcondition:
get_left(p) <= get_right(p)
template<typename T>
static const coordinate_type instigate::geometry::concept::rectangle::interface< T >::get_right ( const T &  p  )  [inline, static]

Returns the right coordinate (x2) of the rectangle.

Parameters:
p - an object of type T
Postcondition:
get_left(p) <= get_right(p)
template<typename T>
static const coordinate_type instigate::geometry::concept::rectangle::interface< T >::get_top ( const T &  p  )  [inline, static]

Returns top coordinate (y2) of the rectangle.

Parameters:
p - an object of type T
Postcondition:
get_bottom(p) <= get_top(p)
template<typename T>
static void instigate::geometry::concept::rectangle::interface< T >::set_bottom ( T &  p,
const coordinate_type v 
) [inline, static]

Sets the bottom coordinate (y1) of the rectangle.

Parameters:
p - an lvalue of type T
v - the new value for the bottom coordinate
Postcondition:
get_bottom(p) == v
Remarks:
The condition bottom <= top is not asserted here in order to allow temporarily making invalid rectangles for sake of efficiency. It is user's responsibility to ensure this pre-condition holds, because in many other algorithms the assertion is present, and if it fires somewhere else it will be very hard to find out where was this condition violated.
Complexity
O(1)
template<typename T>
static void instigate::geometry::concept::rectangle::interface< T >::set_left ( T &  p,
const coordinate_type v 
) [inline, static]

Sets the left coordinate (x1) of the rectangle.

Parameters:
p - an lvalue of type T
v - the new value for the left coordinate
Postcondition:
get_left(p) == v
Remarks:
The condition for right >= left is not asserted here in order to allow temporarily making invalid rectangles for sake of efficiency. It is user's responsibility to ensure this pre-condition holds, because in many other algorithms the assertion is present, and if it fires somewhere else it will be very hard to find out where was this condition violated.
Complexity
O(1)
template<typename T>
static void instigate::geometry::concept::rectangle::interface< T >::set_right ( T &  p,
const coordinate_type v 
) [inline, static]

Sets the right coordinate (x2) of the rectangle.

Parameters:
p - an lvalue of type T
v - the new value for the right coordinate of p
Postcondition:
get_right(p) == v
Remarks:
The condition right >= left is not asserted here in order to allow temporarily making invalid rectangles for sake of efficiency. It is user's responsibility to ensure this pre-condition holds, because in many other algorithms the assertion is present, and if it fires somewhere else it will be very hard to find out where was this condition violated.
Complexity
O(1)
template<typename T>
static void instigate::geometry::concept::rectangle::interface< T >::set_top ( T &  p,
const coordinate_type v 
) [inline, static]

Sets the top coordinate of the rectangle.

Parameters:
p - an lvalue of type T
v - the new value for the top coordinate of p
Postcondition:
get_top(p) == v
Remarks:
The condition top >= bottom is not asserted here in order to allow temporarily making invalid rectangles for sake of efficiency. It is user's responsibility to ensure this pre-condition holds, because in many other algorithms the assertion is present, and if it fires somewhere else it will be very hard to find out where was this condition violated.
Complexity
O(1)

The documentation for this struct was generated from the following file:


© Instigate CJSC, Open Source