6#include "vipra/geometry/f3d.hpp"
7#include "vipra/types/size.hpp"
9#include "vipra/vipra_behaviors/util/class_types.hpp"
11namespace VIPRA::Behaviors {
17using typeUID = uint64_t;
24 DEFAULT_CONSTRUCTIBLE(Ptype)
31 explicit constexpr Ptype(typeUID tid) noexcept : fullType(tid) {}
38 [[nodiscard]]
inline constexpr auto type_count() const -> VIPRA::size
40 VIPRA::size count = 0;
42 while ( (check & fullType) != 0U ) {
57 typeUID type = fullType;
59 while ( check <= type ) {
60 if ( (type & check) != 0U ) {
72 [[nodiscard]]
inline constexpr auto is_type(typeUID type)
const noexcept ->
bool
74 return ((type & fullType) != 0U) && ((~type & fullType) == 0);
82 [[nodiscard]]
inline constexpr auto has_type(typeUID type)
const noexcept ->
bool
84 return (type & fullType) != 0U;
93 inline constexpr auto operator+(typeUID type)
const noexcept -> Ptype
95 return Ptype{fullType | type};
104 inline constexpr auto operator+=(typeUID type)
noexcept -> Ptype&
106 fullType = (fullType | type);
116 inline constexpr auto operator+(Ptype type)
const noexcept -> Ptype
118 return Ptype{fullType | type.fullType};
127 inline constexpr auto operator+=(Ptype type)
noexcept -> Ptype&
129 fullType = (fullType | type.fullType);
139 inline constexpr auto operator-(typeUID type)
const noexcept -> Ptype
141 return Ptype{fullType & ~type};
150 inline constexpr auto operator-=(typeUID type)
noexcept -> Ptype&
152 fullType = (fullType & ~type);
162 inline constexpr auto operator-(Ptype type)
const noexcept -> Ptype
164 return Ptype{fullType & ~type.fullType};
173 inline constexpr auto operator-=(Ptype type)
noexcept -> Ptype&
175 fullType = (fullType & ~type.fullType);
186 inline constexpr auto operator==(Ptype type)
const noexcept ->
bool
188 return fullType == type.fullType;
198 inline constexpr auto operator!=(Ptype type)
const noexcept ->
bool
200 return fullType != type.fullType;
constexpr auto operator-(Ptype type) const noexcept -> Ptype
Returns the difference of the two ptypes.
Definition pedestrian_types.hpp:162
constexpr auto operator-=(Ptype type) noexcept -> Ptype &
Sets the ptype as the difference of the two types.
Definition pedestrian_types.hpp:173
constexpr auto operator+=(Ptype type) noexcept -> Ptype &
Adds the given ptype.
Definition pedestrian_types.hpp:127
constexpr auto operator+=(typeUID type) noexcept -> Ptype &
Adds a type to the ptype.
Definition pedestrian_types.hpp:104
constexpr auto operator-(typeUID type) const noexcept -> Ptype
Returns a ptype without the given type.
Definition pedestrian_types.hpp:139
constexpr auto operator==(Ptype type) const noexcept -> bool
Checks if two ptypes are the same.
Definition pedestrian_types.hpp:186
constexpr auto operator+(typeUID type) const noexcept -> Ptype
Returns they union of the ptype and the type provided.
Definition pedestrian_types.hpp:93
constexpr auto is_type(typeUID type) const noexcept -> bool
Checks if the Ptype has the given type.
Definition pedestrian_types.hpp:72
constexpr auto has_type(typeUID type) const noexcept -> bool
Checks if the Ptype has the given type.
Definition pedestrian_types.hpp:82
constexpr auto operator+(Ptype type) const noexcept -> Ptype
Returns the union of the two ptypes.
Definition pedestrian_types.hpp:116
constexpr auto operator-=(typeUID type) noexcept -> Ptype &
Removes the type from the ptype.
Definition pedestrian_types.hpp:150
constexpr auto type_count() const -> VIPRA::size
Returns the number of different types, excluding the base type (0)
Definition pedestrian_types.hpp:38
void for_each_type(std::function< void(typeUID)> const &func) const
Loops through each individual type, starting from 1, calling func with the type. example(1,...
Definition pedestrian_types.hpp:55
constexpr auto operator!=(Ptype type) const noexcept -> bool
Checks if two ptypes are different.
Definition pedestrian_types.hpp:198