50#ifndef LASS_GUARDIAN_OF_INCLUSION_PRIM_XYZW_H
51#define LASS_GUARDIAN_OF_INCLUSION_PRIM_XYZW_H
65 static constexpr size_t dimension = 4;
69 constexpr XYZW(): value_(0) {}
102 throw util::Exception(
"Invalid parameter axis. Try 'x', 'X', 'y', 'Y', 'z', 'Z', 'w' or 'W'.", LASS_PRETTY_FUNCTION);
109 explicit constexpr XYZW(
int value): value_(value) {}
115 if (
axis.length() != 1)
117 LASS_THROW(
"Invalid parameter axis '" <<
axis <<
"'. It must be a single character.");
122 constexpr XYZW(
const XYZW& other) =
default;
123 constexpr XYZW& operator=(
const XYZW& other) =
default;
129 LASS_ASSERT(value_ >= 0 && value_ <
static_cast<int>(dimension));
130 constexpr char axes[] = {
'x',
'y',
'z',
'w' };
134 constexpr operator int()
const {
return value_; }
135 constexpr operator size_t()
const {
return static_cast<size_t>(value_); }
137 constexpr XYZW& operator++()
142 constexpr XYZW& operator--()
148 constexpr XYZW operator++(
int)
150 const XYZW result(*
this);
154 constexpr XYZW operator--(
int)
156 const XYZW result(*
this);
161 constexpr XYZW& operator+=(
int offset)
166 constexpr XYZW& operator-=(
int offset)
172 constexpr XYZW operator+(
int offset)
const
174 return XYZW(value_ + offset);
176 constexpr XYZW operator-(
int offset)
const
178 return XYZW(value_ - offset);
181 constexpr bool operator==(
XYZW other)
const
183 return value_ == other.value_;
185 constexpr bool operator==(
int other)
const
187 return static_cast<int>(value_) == other;
189 constexpr bool operator==(
size_t other)
const
191 return static_cast<size_t>(value_) == other;
193 constexpr bool operator==(
char other)
const
195 return *
this ==
XYZW(other);
197 bool operator==(
const std::string& other)
const
199 return *
this ==
XYZW(other);
202 constexpr bool operator!=(
XYZW other)
const
204 return value_ != other.value_;
206 constexpr bool operator!=(
int other)
const
208 return static_cast<int>(value_) != other;
210 constexpr bool operator!=(
size_t other)
const
212 return static_cast<size_t>(value_) != other;
214 constexpr bool operator!=(
char other)
const
216 return *
this !=
XYZW(other);
218 bool operator!=(
const std::string& other)
const
220 return *
this !=
XYZW(other);
225 typedef num::Modulo<dimension, int> TValue;
232inline constexpr bool operator==(
int a,
const XYZW& b)
239inline constexpr bool operator==(
size_t a,
const XYZW& b)
246inline constexpr bool operator==(
char a,
const XYZW& b)
253inline bool operator==(
const std::string& a,
const XYZW& b)
260inline constexpr bool operator!=(
int a,
const XYZW& b)
267inline constexpr bool operator!=(
size_t a,
const XYZW& b)
274inline constexpr bool operator!=(
char a,
const XYZW& b)
281inline bool operator!=(
const std::string& a,
const XYZW& b)
288template <
typename Char,
typename Traits>
289std::basic_ostream<Char, Traits>& operator<<(std::basic_ostream<Char, Traits>& stream,
const XYZW& xyzw)
291 stream << xyzw.axis();
301#define LASS_PRIM_HAVE_PY_EXPORT_TRAITS_XYZW
302#ifdef LASS_GUARDIAN_OF_INCLUSION_UTIL_PYOBJECT_PLUS_H
cyclic iterator over xyzw indices
constexpr XYZW()
intializes iterator to x axis.
constexpr char axis() const
return axis by character: 'x', 'y', 'z' or 'w'.
XYZW(const std::string &axis)
initializes iterator to an axis by character: "x", "y", "z" or "w".
constexpr XYZW(char axis)
initializes iterator to an axis by character: 'x', 'y', 'z' or 'w'.
constexpr XYZW(int value)
initializes iterator to an axis by number.
type of all exceptions in lass
set of geometrical primitives
Library for Assembled Shared Sources.