12 #ifndef __OP_DataTypes_h__
13 #define __OP_DataTypes_h__
29 #define OP_USE_STRICT_IDX_TYPES 0
30 #if OP_USE_STRICT_IDX_TYPES
35 #endif // OP_USE_STRICT_IDX_TYPES
45 #if OP_USE_STRICT_IDX_TYPES
47 #define OP_ARITHMETIC(TEMPLATE, __VA_ARGS__) \
48 TEMPLATE(+, __VA_ARGS__) \
49 TEMPLATE(-, __VA_ARGS__) \
50 TEMPLATE(*, __VA_ARGS__) \
51 TEMPLATE(/, __VA_ARGS__) \
52 TEMPLATE(%, __VA_ARGS__)
54 #define OP_COMPARISON(TEMPLATE, __VA_ARGS__) \
55 TEMPLATE(<, __VA_ARGS__) \
56 TEMPLATE(<=, __VA_ARGS__) \
57 TEMPLATE(>, __VA_ARGS__) \
58 TEMPLATE(>=, __VA_ARGS__) \
59 TEMPLATE(==, __VA_ARGS__) \
60 TEMPLATE(!=, __VA_ARGS__)
62 template <
typename Tag>
67 constexpr OP_IdxType() noexcept =
default;
68 constexpr OP_IdxType(
int v) : myValue(v) {}
69 constexpr OP_IdxType(
exint v) : myValue(v) {}
70 constexpr OP_IdxType(
const OP_IdxType &) noexcept =
default;
71 constexpr OP_IdxType(OP_IdxType &&) noexcept =
default;
73 constexpr OP_IdxType &
operator=(
const OP_IdxType &) =
default;
74 constexpr OP_IdxType &
operator=(OP_IdxType &&) =
default;
78 template <
typename OtherTag>
79 constexpr
explicit OP_IdxType(
const OP_IdxType<OtherTag> &other)
80 : myValue(other.myValue) {}
84 constexpr
explicit OP_IdxType(
unsigned v) : myValue(v) {}
87 constexpr OP_IdxType &
operator=(
int v) { myValue =
v;
return *
this; }
89 constexpr
explicit operator int()
const {
return myValue; }
90 constexpr
explicit operator bool()
const {
return myValue; }
91 constexpr
operator exint()
const {
return myValue; }
95 template <
typename T> constexpr OP_IdxType(
T) =
delete;
96 template <
typename T> constexpr OP_IdxType &
operator=(
T v) =
delete;
97 template <
typename T> constexpr
operator T()
const =
delete;
100 constexpr OP_IdxType &operator++() { ++myValue;
return *
this; }
101 constexpr OP_IdxType &operator--() { --myValue;
return *
this; }
102 constexpr OP_IdxType operator++(
int)
103 { OP_IdxType tmp = *
this; ++myValue;
return tmp; }
104 constexpr OP_IdxType operator--(
int)
105 { OP_IdxType tmp = *
this; --myValue;
return tmp; }
107 { myValue += other;
return *
this; }
108 constexpr OP_IdxType &
operator+=(OP_IdxType other)
109 { myValue += other;
return *
this; }
113 constexpr
const exint *operator&()
const {
return &myValue; }
114 constexpr
exint *operator&() {
return &myValue; }
118 #define OP_IDXTYPE_ARITHMETIC_TEMPLATE(OPERATOR) \
119 constexpr OP_IdxType operator OPERATOR (OP_IdxType other) const \
120 { return OP_IdxType(myValue OPERATOR other.myValue); }
121 OP_ARITHMETIC(OP_IDXTYPE_ARITHMETIC_TEMPLATE)
122 #undef OP_IDXTYPE_ARITHMETIC_TEMPLATE
125 #define OP_IDXTYPE_COMPARISON_TEMPLATE(OPERATOR) \
126 constexpr bool operator OPERATOR (OP_IdxType other) const \
127 { return myValue OPERATOR other.myValue; }
128 OP_COMPARISON(OP_IDXTYPE_COMPARISON_TEMPLATE)
129 #undef OP_IDXTYPE_COMPARISON_TEMPLATE
133 #define OP_IDXTYPE_ARITHMETIC_TEMPLATE(OPERATOR, TYPE) \
134 template <typename Tag> \
135 constexpr TYPE operator OPERATOR (TYPE lhs, OP_IdxType<Tag> rhs) \
136 { return lhs OPERATOR rhs.myValue; } \
137 template <typename Tag> \
138 constexpr TYPE operator OPERATOR (OP_IdxType<Tag> lhs, TYPE rhs) \
139 { return lhs.myValue OPERATOR rhs; }
140 OP_ARITHMETIC(OP_IDXTYPE_ARITHMETIC_TEMPLATE,
int)
141 OP_ARITHMETIC(OP_IDXTYPE_ARITHMETIC_TEMPLATE,
exint)
142 OP_ARITHMETIC(OP_IDXTYPE_ARITHMETIC_TEMPLATE,
unsigned)
143 #undef OP_IDXTYPE_ARITHMETIC_TEMPLATE
146 #define OP_IDXTYPE_COMPARISON_TEMPLATE(OPERATOR, TYPE) \
147 template <typename Tag> \
148 constexpr bool operator OPERATOR (TYPE lhs, OP_IdxType<Tag> rhs) \
149 { return lhs OPERATOR rhs.myValue; } \
150 template <typename Tag> \
151 constexpr bool operator OPERATOR (OP_IdxType<Tag> lhs, TYPE rhs) \
152 { return lhs.myValue OPERATOR rhs; }
153 OP_COMPARISON(OP_IDXTYPE_COMPARISON_TEMPLATE,
int)
154 OP_COMPARISON(OP_IDXTYPE_COMPARISON_TEMPLATE,
exint)
155 OP_COMPARISON(OP_IDXTYPE_COMPARISON_TEMPLATE,
unsigned)
156 #undef OP_IDXTYPE_COMPARISON_TEMPLATE
161 template <
typename Tag>
162 constexpr std::ostream &operator<<(std::ostream &os, OP_IdxType<Tag> idx)
163 {
return os << idx.myValue; }
165 template <
typename Tag>
167 {
return SYShash(idx.myValue); }
172 struct OP_IdxTypeInputTag {};
173 struct OP_IdxTypeOutputTag {};
175 using OP_InputIdx = OP_IdxType<OP_IdxTypeInputTag>;
187 #endif // OP_USE_STRICT_IDX_TYPES
The change type wasn't set, so it could be any of them.
typedef int(APIENTRYP RE_PFNGLXSWAPINTERVALSGIPROC)(int)
The node's OTL definition match state changed.
#define SYS_DEPRECATED(__V__)
The input/output connections have changed.
constexpr size_t SYShash(const SYS_Flicks f)
A post-it owned by this network changed.
UT_Array< OP_Node * > OP_NodeList
The node's delete script changed.
A dot owned by this network changed.
std::size_t SYS_HashType
Define the type for hash values.
UT_IntrusivePtr< OP_DataBlock > OP_DataBlockPtr
The pick/selection state changed.
The expression language changed.
A network box owned by this network changed.
OIIO_FORCEINLINE const vint4 & operator+=(vint4 &a, const vint4 &b)
Wrapper around hboost::intrusive_ptr.
UT_ValArray< OP_NetworkBoxItem * > OP_NetworkBoxItemList
The node's compress (thumbnail) flag changed.
The node's color changed.
LeafData & operator=(const LeafData &)=delete
Errors/warnings got set/cleared.
The active input changed.
size_t hash_value(const CH_ChannelRef &ref)
The node's comment changed.