11 #ifndef __APEX_FLEXIBLEDICT_H__
12 #define __APEX_FLEXIBLEDICT_H__
43 struct DefaultClearer;
54 static const bool clearNeedsDestruction =
true;
76 myBuffer = UTmakeUnique<APEX_Buffer>();
77 myExternalBuffer =
nullptr;
84 myBuffer = UTmakeUnique<APEX_Buffer>();
85 myExternalBuffer =
nullptr;
86 mergeUtOptions(opt,
true);
92 myBuffer = UTmakeUnique<APEX_Buffer>();
93 myExternalBuffer =
nullptr;
94 mergeUtOptions(opt,
true);
103 myBuffer = UTmakeUnique<APEX_Buffer>();
104 myExternalBuffer = other.myExternalBuffer;
105 if (!myExternalBuffer)
108 update(other,
true,
true);
111 myDataId = other.myDataId;
119 return myMap.contains(key);
124 return myMap.empty();
136 template <
typename T>
139 auto it = myMap.find(key);
142 return castArg<T>(&it->second);
145 template <
typename T>
148 auto it = myMap.find(key);
151 return castArg<T>(&it->second);
154 template <
typename T>
158 bool add_missing =
true,
159 bool allow_type_change =
false,
160 bool bump_data_id =
true)
162 if (!isValidKey(key))
165 msg.
format(
"set() called with invalid key {}", key);
170 auto it = myMap.find(key);
182 myMap[key] = appendTrackedArgument(type_defn);
190 if (!allow_type_change)
197 it->second = appendTrackedArgument(type_defn);
211 bool add_missing =
true,
212 bool allow_type_change =
false,
213 bool force_update =
false,
214 bool bump_data_id =
true,
215 bool bump_data_id_on_conversion =
true);
220 bool add_missing =
true,
221 bool allow_type_change =
false,
222 bool force_update =
false,
223 bool bump_data_id =
true,
224 bool bump_data_id_on_conversion =
true);
244 bool add_missing =
false,
245 bool allow_type_change =
false,
246 bool force_copy =
false,
248 bool bump_data_id_on_conversion =
true);
252 bool add_missing =
true,
253 bool allow_type_change =
true,
255 void updateUtOptions(
258 bool include_geometry =
false,
259 bool include_typeinfo =
true)
const;
260 void updateUtOptions(
263 bool include_geometry =
false,
264 bool include_typeinfo =
true)
const;
272 if (!myExternalBuffer)
291 template <
typename T>
292 void setReinterpretFloatArray(
297 static_assert(std::is_same_v<typename T::value_type, Float>);
300 set<ApexArray<T>>(name, tmp, add_missing,
false,
false);
303 APEX_TrackedArgument appendTrackedArgument(
const APEX_TypeDefinitionBase *type_defn)
305 APEX_Argument
arg =
buffer()->append(type_defn);
306 return {{arg.buffer, arg.type_defn, arg.offset}, };
311 APEX_Buffer *myExternalBuffer;
315 template <
typename T>
316 static std::type_index
319 return std::type_index(
typeid(T));
326 const APEX_Argument &
arg,
327 bool include_geometry =
false,
328 bool include_typeinfo =
true);
332 #endif // header guard
static APEX_DataID nextDataId()
Get a new unique data ID.
APEX_ParmDict & operator=(const APEX_ParmDict &other)
GLsizei const GLfloat * value
APEX_ParmDict(const APEX_ParmDict &other)
SYS_FORCE_INLINE const char * buffer() const
void setUtOption(UT_Options &opt, const UT_StringRef &key, const APEX_Argument &arg, bool include_geometry=false, bool include_typeinfo=true)
bool contains(const UT_StringRef &key) const
auto arg(const Char *name, const T &arg) -> detail::named_arg< Char, T >
Holds all of the memory for execution state of a compiled APEX graph.
std::unique_ptr< T, Deleter > UT_UniquePtr
A smart pointer for unique ownership of dynamically allocated objects.
void operator=(const UT_OptionsHolder &opt)
#define UT_ASSERT_MSG(ZZ,...)
const UT_ArrayStringMap< APEX_TrackedArgument > & map() const
static void clear(apex::APEX_TrackedArgument &v)
APEX_DataID dataId() const
static void clearConstruct(apex::APEX_TrackedArgument *p)
constexpr auto set(type rhs) -> int
const APEX_TypeDefinitionBase * type_defn
UT_ArrayStringMap< APEX_TrackedArgument > & map()
GLuint const GLchar * name
A map of string to various well defined value types.
size_t format(const char *fmt, const Args &...args)
void copyDataId(const APEX_ParmDict &other)
void set(const UT_StringRef &key, const T &value, bool add_missing=true, bool allow_type_change=false, bool bump_data_id=true)
APEX_ParmDict(const UT_OptionsHolder &opt)
Represents a location for a single object inside of an APEX_Buffer.
static bool isClear(const apex::APEX_TrackedArgument &v)