Spatial C++ Library
Generic Multi-Dimensional Containers and Spatial Operations
spatial::except Namespace Reference

Functions

void check_rank (dimension_type rank)
 Checks that rank is not null. More...
 
void check_even_rank (dimension_type rank)
 Checks that rank is not null and that it is a multiple of 2. More...
 
void check_dimension (dimension_type rank, dimension_type dimension)
 Checks that dimension is not greater or equal to rank. More...
 
template<typename Node >
void check_node (Node *node)
 Checks that the node's pointer given as an argument to a function is not null or does not point to a header node. More...
 
template<typename Node >
void check_node_iterator (Node *node)
 Checks that the node pointed to by an iterator and given as an argument to a function is not null or does not point to a header node. More...
 
template<typename Ptr1 , typename Ptr2 >
void check_iterator (Ptr1 ptr1, Ptr2 ptr2)
 Checks if two iterators are of equal values, if not raises the invalid_iterator exception. More...
 
template<typename Tp >
void check_empty_container (const Tp &cont)
 Checks that the container given as an argument to a function is not empty. More...
 
template<typename Tp >
void check_open_bounds (const Tp &container, const typename container_traits< Tp >::key_type &lower, const typename container_traits< Tp >::key_type &upper)
 Checks if all coordinates of lower are strictly less than these of higher along the same dimensions. More...
 
template<typename Tp >
void check_bounds (const Tp &container, const typename container_traits< Tp >::key_type &lower, const typename container_traits< Tp >::key_type &upper)
 Checks if all coordinates of lower are strictly less than these of higher along the same dimensions. More...
 
template<typename Tp >
void check_closed_bounds (const Tp &container, const typename container_traits< Tp >::key_type &lower, const typename container_traits< Tp >::key_type &upper)
 Checks if all coordinates of lower are less or equal to these of higher along the same dimensions. More...
 
template<typename Tp >
enable_if< import::is_arithmetic< Tp > >::type check_positive_distance (Tp x)
 Check that the distance given x has a positive value. More...
 
template<typename Tp >
enable_if< import::is_arithmetic< Tp >, Tp >::type check_positive_add (Tp x, Tp y)
 This arithmetic check is only used when the macro SPATIAL_SAFER_ARITHMETICS is defined. More...
 
template<typename Tp >
enable_if< import::is_arithmetic< Tp >, Tp >::type check_square (Tp x)
 This arithmetic check is only used when the macro SPATIAL_SAFER_ARITHMETICS is defined. More...
 
template<typename Tp >
enable_if< import::is_arithmetic< Tp >, Tp >::type check_positive_mul (Tp x, Tp y)
 This arithmetic check is only used when the macro SPATIAL_SAFER_ARITHMETICS is defined. More...
 
template<typename Tp >
void check_box (const Tp &container, const typename container_traits< Tp >::key_type &box, llhh_layout_tag)
 Checks that all coordinates of a box are matching with the layout specified or else, raise an invalid_box exception. More...
 
template<typename Tp >
void check_box (const Tp &container, const typename container_traits< Tp >::key_type &box, hhll_layout_tag)
 Checks that all coordinates of a box are matching with the layout specified or else, raise an invalid_box exception. More...
 
template<typename Tp >
void check_box (const Tp &container, const typename container_traits< Tp >::key_type &box, lhlh_layout_tag)
 Checks that all coordinates of a box are matching with the layout specified or else, raise an invalid_box exception. More...
 
template<typename Tp >
void check_box (const Tp &container, const typename container_traits< Tp >::key_type &box, hlhl_layout_tag)
 Checks that all coordinates of a box are matching with the layout specified or else, raise an invalid_box exception. More...
 
template<typename Tp >
enable_if_c< std::numeric_limits< Tp >::is_integer &&std::numeric_limits< Tp >::is_signed, Tp >::type check_abs (Tp x)
 This arithmetic check is only used when the macro SPATIAL_SAFER_ARITHMETICS is defined. More...
 
template<typename Tp >
enable_if_c<!std::numeric_limits< Tp >::is_integer||!std::numeric_limits< Tp >::is_signed, Tp >::type check_abs (Tp x)
 This arithmetic check is only used when the macro SPATIAL_SAFER_ARITHMETICS is defined. More...
 

Function Documentation

template<typename Tp >
enable_if_c<std::numeric_limits<Tp>::is_integer && std::numeric_limits<Tp>::is_signed, Tp>::type spatial::except::check_abs ( Tp  x)

This arithmetic check is only used when the macro SPATIAL_SAFER_ARITHMETICS is defined.

Check that the absolute of an element has not led to an error such as an overflow, by forcing the error itself.

This check is not the best check for arithmetic errors. There are probably ways to make it faster, but it is intended to be portable and provide users with the possibility to quickly check the architmectics during computation with little efforts from their part.

The std::abs() function is working fine for floating point types, however, for signed integral types (char, wchar_t, short, int, long, long long) and their signed version, it returns an incorrect value when trying to compute std::abs(std::numeric_limits<signed int>::min()). To signal this issue we raise an exception in this case.

Definition at line 74 of file spatial_math.hpp.

template<typename Tp >
enable_if_c<!std::numeric_limits<Tp>::is_integer || !std::numeric_limits<Tp>::is_signed, Tp>::type spatial::except::check_abs ( Tp  x)

This arithmetic check is only used when the macro SPATIAL_SAFER_ARITHMETICS is defined.

Check that the absolute of an element has not led to an error such as an overflow, by forcing the error itself.

This check is not the best check for arithmetic errors. There are probably ways to make it faster, but it is intended to be portable and provide users with the possibility to quickly check the architmectics during computation with little efforts from their part.

The std::abs() function is working fine for floating point types, however, for signed integral types (char, wchar_t, short, int, long, long long) and their signed version, it returns an incorrect value when trying to compute std::abs(std::numeric_limits<signed int>::min()). To signal this issue we raise an exception in this case.

Definition at line 89 of file spatial_math.hpp.

template<typename Tp >
void spatial::except::check_bounds ( const Tp &  container,
const typename container_traits< Tp >::key_type &  lower,
const typename container_traits< Tp >::key_type &  upper 
)

Checks if all coordinates of lower are strictly less than these of higher along the same dimensions.

The number of dimensions is limited by the rank of container.

Exceptions
invalid_boundsis thrown if the check fails.

This check is performed mainly upon creation of a bounds predicate.

Definition at line 150 of file spatial_except.hpp.

template<typename Tp >
void spatial::except::check_box ( const Tp &  container,
const typename container_traits< Tp >::key_type &  box,
llhh_layout_tag   
)

Checks that all coordinates of a box are matching with the layout specified or else, raise an invalid_box exception.

Exceptions
invalid_boxis raised when one of box's lower coordinates have a greater values than their corresponding higher coordinates, it could mean that box is invalid or does not match the specified layout.
Parameters
containerthat could be used to store the box
boxthe box that must be checked.

Definition at line 190 of file spatial_except.hpp.

template<typename Tp >
void spatial::except::check_box ( const Tp &  container,
const typename container_traits< Tp >::key_type &  box,
hhll_layout_tag   
)

Checks that all coordinates of a box are matching with the layout specified or else, raise an invalid_box exception.

Exceptions
invalid_boxis raised when one of box's lower coordinates have a greater values than their corresponding higher coordinates, it could mean that box is invalid or does not match the specified layout.
Parameters
containerthat could be used to store the box
boxthe box that must be checked.

Definition at line 203 of file spatial_except.hpp.

template<typename Tp >
void spatial::except::check_box ( const Tp &  container,
const typename container_traits< Tp >::key_type &  box,
lhlh_layout_tag   
)

Checks that all coordinates of a box are matching with the layout specified or else, raise an invalid_box exception.

Exceptions
invalid_boxis raised when one of box's lower coordinates have a greater values than their corresponding higher coordinates, it could mean that box is invalid or does not match the specified layout.
Parameters
containerthat could be used to store the box
boxthe box that must be checked.

Definition at line 216 of file spatial_except.hpp.

template<typename Tp >
void spatial::except::check_box ( const Tp &  container,
const typename container_traits< Tp >::key_type &  box,
hlhl_layout_tag   
)

Checks that all coordinates of a box are matching with the layout specified or else, raise an invalid_box exception.

Exceptions
invalid_boxis raised when one of box's lower coordinates have a greater values than their corresponding higher coordinates, it could mean that box is invalid or does not match the specified layout.
Parameters
containerthat could be used to store the box
boxthe box that must be checked.

Definition at line 228 of file spatial_except.hpp.

template<typename Tp >
void spatial::except::check_closed_bounds ( const Tp &  container,
const typename container_traits< Tp >::key_type &  lower,
const typename container_traits< Tp >::key_type &  upper 
)

Checks if all coordinates of lower are less or equal to these of higher along the same dimensions.

The number of dimensions is limited by the rank of container.

Exceptions
invalid_closed_boundsis thrown if the check fails.

This check is performed mainly upon creation of a closed_bounds predicate.

Definition at line 168 of file spatial_except.hpp.

void spatial::except::check_dimension ( dimension_type  rank,
dimension_type  dimension 
)

Checks that dimension is not greater or equal to rank.

Exceptions
invalid_dimensionis thrown if checks fails.

Definition at line 50 of file spatial_except.hpp.

template<typename Tp >
void spatial::except::check_empty_container ( const Tp &  cont)

Checks that the container given as an argument to a function is not empty.

Exceptions
invalid_empty_containeris thrown if checks fails.
Parameters
contthe container that must not be empty.

Definition at line 109 of file spatial_except.hpp.

void spatial::except::check_even_rank ( dimension_type  rank)

Checks that rank is not null and that it is a multiple of 2.

Exceptions
invalid_rankis thrown if checks fails.

Definition at line 34 of file spatial_except.hpp.

template<typename Ptr1 , typename Ptr2 >
void spatial::except::check_iterator ( Ptr1  ptr1,
Ptr2  ptr2 
)

Checks if two iterators are of equal values, if not raises the invalid_iterator exception.

Exceptions
invalid_iteratoris raised when the nodes specified are not matching.

For this test to be useful, one of the iterator must be sure to belong to a container.

Definition at line 95 of file spatial_except.hpp.

template<typename Node >
void spatial::except::check_node ( Node *  node)

Checks that the node's pointer given as an argument to a function is not null or does not point to a header node.

Exceptions
invalid_nodeis thrown if checks fails.
Parameters
nodethe node pointer to check.

Definition at line 67 of file spatial_except.hpp.

template<typename Node >
void spatial::except::check_node_iterator ( Node *  node)

Checks that the node pointed to by an iterator and given as an argument to a function is not null or does not point to a header node.

Exceptions
invalid_iteratoris thrown if checks fails.

Definition at line 79 of file spatial_except.hpp.

template<typename Tp >
void spatial::except::check_open_bounds ( const Tp &  container,
const typename container_traits< Tp >::key_type &  lower,
const typename container_traits< Tp >::key_type &  upper 
)

Checks if all coordinates of lower are strictly less than these of higher along the same dimensions.

The number of dimensions is limited by the rank of container.

Exceptions
invalid_boundsis thrown if the check fails.
Parameters
containerproviding type information, comparison and rank.
lowerthe lower bound of the interval considered.
upperthe upper bound of the interval considered.

This check is performed mainly upon creation of a open_bounds predicate.

Definition at line 129 of file spatial_except.hpp.

template<typename Tp >
enable_if<import::is_arithmetic<Tp>, Tp>::type spatial::except::check_positive_add ( Tp  x,
Tp  y 
)

This arithmetic check is only used when the macro SPATIAL_SAFER_ARITHMETICS is defined.

Check that the addtion of 2 elements of positive value has not led to an error such as an overflow, by forcing the error itself.

This check is not the best check for arithmetic errors. There are ways to make it faster, but it is intended to be portable and provide users with the possibility to quickly check the architmectics during computation with little efforts from their part.

In particular, if Tp is not a base type, the author of the type must define the numeric limits numeric_limits<Tp>::max() for that type.

Definition at line 109 of file spatial_math.hpp.

template<typename Tp >
enable_if<import::is_arithmetic<Tp> >::type spatial::except::check_positive_distance ( Tp  x)

Check that the distance given x has a positive value.

Exceptions
negative_distance

Definition at line 42 of file spatial_math.hpp.

template<typename Tp >
enable_if<import::is_arithmetic<Tp>, Tp>::type spatial::except::check_positive_mul ( Tp  x,
Tp  y 
)

This arithmetic check is only used when the macro SPATIAL_SAFER_ARITHMETICS is defined.

Check that the multiplication of 2 positive elements has not resulted into an arithmetic error such as an overflow.

This check will only work for 2 positive element x and y. This check is not the best check for arithmetic errors. There are ways to make it better, but it's hard to make it more portable.

In particular, if Tp is not a base type, the author of the type must define the numeric limits std::numeric_limits<Tp>::max() for that type.

Definition at line 166 of file spatial_math.hpp.

void spatial::except::check_rank ( dimension_type  rank)

Checks that rank is not null.

Exceptions
invalid_rankis thrown if checks fails.

Definition at line 27 of file spatial_except.hpp.

template<typename Tp >
enable_if<import::is_arithmetic<Tp>, Tp>::type spatial::except::check_square ( Tp  x)

This arithmetic check is only used when the macro SPATIAL_SAFER_ARITHMETICS is defined.

Check that the computation of the square of an element has not overflown.

This check is not the best check for arithmetic errors. There are ways to make it faster, but it is intended to be portable and provide users with the possibility to quickly check the architmectics during computation with little efforts from their part.

Definition at line 133 of file spatial_math.hpp.