68#ifndef LASS_GUARDIAN_OF_INCLUSION_PRIM_MIN_MAX_POLICY_H
69#define LASS_GUARDIAN_OF_INCLUSION_PRIM_MIN_MAX_POLICY_H
81class MinMaxError:
public util::ExceptionMixin<MinMaxError>
84 MinMaxError(std::string msg, std::string loc): util::ExceptionMixin<MinMaxError>(std::move(msg), std::move(loc)) {}
85 ~MinMaxError()
noexcept {}
124 template <
typename Po
intType>
125 static void setMin(PointType& oMin,
const PointType& iMax,
const PointType& iMin)
127 if (pointwiseMin(iMin, iMax) != iMin)
129 LASS_THROW_EX(
MinMaxError,
"client tries to set invalid minimum '" << iMin
130 <<
"' with maximum '" << iMax <<
"'");
138 template <
typename Po
intType>
139 static void setMax(
const PointType& iMin, PointType& oMax,
const PointType& iMax)
141 if (pointwiseMin(iMin, iMax) != iMin)
143 LASS_THROW_EX(
MinMaxError,
"client tries to set invalid maximum '" << iMax
144 <<
"' with minimum '" << iMin <<
"'");
152 template <
typename Po
intType>
153 static void checkMinMax(
const PointType& iMin,
const PointType& iMax)
155 if (pointwiseMin(iMin, iMax) != iMin)
157 LASS_THROW_EX(
MinMaxError,
"inconsistent mininum '" << iMin <<
"' and maximum '" << iMax <<
"'");
226 template <
typename Po
intType>
227 static void setMin(PointType& oMin, PointType& ioMax,
const PointType& iMin)
229 ioMax = pointwiseMax(ioMax, iMin);
235 template <
typename Po
intType>
236 static void setMax(PointType& ioMin, PointType& oMax,
const PointType& iMax)
238 ioMin = pointwiseMin(ioMin, iMax);
244 template <
typename Po
intType>
247 const PointType min = pointwiseMin(ioMin, ioMax);
248 ioMax = pointwiseMax(ioMin, ioMax);
275 template <
typename Po
intType>
276 static void setMin(PointType& oMin, PointType& ,
const PointType& iMin)
283 template <
typename Po
intType>
284 static void setMax(PointType& , PointType& oMax,
const PointType& iMax)
291 template <
typename Po
intType>
Exception thrown by StrictMinMax.
set of geometrical primitives
Library for Assembled Shared Sources.
MinMaxPolicy automatically correcting wrong minima and maxima.
static void checkMinMax(PointType &ioMin, PointType &ioMax)
correct ioMin and ioMax so that they are indeed then minimum and maximum.
static void setMax(PointType &ioMin, PointType &oMax, const PointType &iMax)
set value oMax to iMax and move ioMin (if necessary) so it stays correct.
static void setMin(PointType &oMin, PointType &ioMax, const PointType &iMin)
set value oMin to iMin and move ioMax (if necessary) so it stays correct.
MinMaxPolicy enforcing strict rules for the minima and maxima.
static void checkMinMax(const PointType &iMin, const PointType &iMax)
check if iMin and iMax are valid minima and maxima.
static void setMin(PointType &oMin, const PointType &iMax, const PointType &iMin)
set value oMin to iMin
static void setMax(const PointType &iMin, PointType &oMax, const PointType &iMax)
set value oMax to iMax
MinMaxPolicy that makes it your responsibility to behave well.
static void setMax(PointType &, PointType &oMax, const PointType &iMax)
set value oMax to iMax and move ioMin (if necessary) so it stays correct.
static void setMin(PointType &oMin, PointType &, const PointType &iMin)
set value oMin to iMin and move ioMax (if necessary) so it stays correct.
static void checkMinMax(PointType &, PointType &)
correct ioMin and ioMax so that they are indeed then minimum and maximum.