11 #ifndef __APEX_INCLUDE_H__
12 #define __APEX_INCLUDE_H__
46 #include <type_traits>
111 template <
typename T>
116 VariadicArg(std::initializer_list<std::pair<const char *, T *>> inputs) : myNames(), myData()
120 for (
auto &[
name, p] : inputs)
137 if (myData.
size() != myNames.
size())
142 return myData.
size();
159 return myNames.
find(name);
166 arr[i] = *
operator[](i);
181 template<
typename IterT>
194 return *myBegin[index];
199 return *myBegin[index];
206 IterT myBegin, myEnd;
244 template <
typename...
T,
size_t... I>
251 template <
typename...
T>
264 std::string tag_name(tag_key);
265 std::string theprefix;
266 std::string delimiter =
".";
268 auto pos = tag_name.find(delimiter);
269 while (pos != std::string::npos)
271 theprefix = tag_name.substr(0, pos);
272 if (pos != std::string::npos)
273 tag_name.erase(0, pos + delimiter.length());
275 pos = tag_name.find(delimiter);
284 if (portname.
length() > 1 && portname.
c_str()[0] ==
'*')
285 return portname.
c_str() + 1;
286 return portname.
c_str();
289 #define APEX_ID(IdType) \
290 class IdType : public UN_DataIndex \
293 explicit IdType(UN_DataIndex data_index = UN_DataIndex()) : UN_DataIndex(data_index) \
298 #define APEX_INDEX(IndexType) \
299 class IndexType : public UN_DataIndex \
302 explicit IndexType(UN_DataIndex data_index = UN_DataIndex()) : UN_DataIndex(data_index) \
310 template <typename T>
315 template <
typename T>
321 #define APEX_INVALID_GRAPHDATAID -1
344 #define APEX_ID_CLEARER(IdType) \
346 struct DefaultClearer<IdType> \
348 static void clear(IdType &v) \
352 static bool isClear(const IdType &v) \
354 return !v.isValid(); \
356 static void clearConstruct(IdType *p) \
360 static const bool clearNeedsDestruction = false; \
363 #define APEX_INDEX_CLEARER(IndexType) \
365 struct DefaultClearer<IndexType> \
367 static void clear(IndexType &v) \
371 static bool isClear(const IndexType &v) \
373 return !v.isValid(); \
375 static void clearConstruct(IndexType *p) \
379 static const bool clearNeedsDestruction = false; \
382 #define APEX_NUMBER_FORMATTER(IdOrIndexType) \
383 inline size_t format(char *buffer, size_t buffer_size, const IdOrIndexType &v) \
385 UT::Format::Writer w(buffer, buffer_size); \
386 UT::Format::Formatter f; \
387 return f.format(w, #IdOrIndexType "({})", {v.exintValue()}); \
397 template <
typename T>
ColorRamp(const UT_Ramp &ramp)
#define UTdebugPrint(...)
Normal callback which is unconditionally executed.
int addNode(fpreal pos)
Returns the index of the inserted node.
#define APEX_NUMBER_FORMATTER(IdOrIndexType)
PRM_DataItemHandle DataItem
SYS_FORCE_INLINE constexpr exint length() const
auto makerefs(UT_Tuple< T...> &t)
UN_SubnetID APEX_SubnetID
void setCapacity(exint new_capacity)
std::tuple< Types...> UT_Tuple
**But if you need a result
const IndirectRange< const_iterator > indirectRange() const
typename UT_Array< T * >::iterator iterator
exint find(const S &s, exint start=0) const
const T & operator[](exint index) const
#define APEX_INDEX(IndexType)
Marks the start of an arbitrary loop, expects RunData to be an iterator.
void setSize(exint newsize)
std::decay_t< decltype(make_index_sequence_impl< N >())> make_index_sequence
void toArray(UT_Array< T > &arr) const
UT_SharedPtr< const PRM_DataItem > PRM_DataItemHandle
UN_PortKind
Differentiates between input and output ports.
void append(const UT_StringHolder &name, T *item)
IndirectRange< iterator > indirectRange()
exint emplace_back(S &&...s)
std::shared_ptr< T > UT_SharedPtr
Wrapper around std::shared_ptr.
auto makeref(UT_Tuple< T...> &t, std::index_sequence< I...>)
typename UT_Array< T * >::const_iterator const_iterator
VariadicArg(std::initializer_list< std::pair< const char *, T * >> inputs)
GLuint const GLchar * name
SYS_FORCE_INLINE constexpr const char * c_str() const
#define APEX_ID_CLEARER(IdType)
const UT_Array< UT_StringHolder > & names() const
const_iterator end() const
UT_RGBAT< fpreal32 > UT_FRGBA
Utility class for containing a color ramp.
T * operator[](exint idx)
SIM_API const UT_StringHolder distance
exint nameToIndex(const UT_StringRef &name) const
const_iterator begin() const
const T * operator[](exint idx) const
T & operator[](exint index)
iterator end()
End iterator.
FloatRamp(const UT_Ramp &ramp)
Do nothing; ignored after compilation.
APEX_SubnetID APEX_GraphID
#define APEX_INDEX_CLEARER(IndexType)