11 #ifndef __APEX_COW_H__
12 #define __APEX_COW_H__
60 return (**this).append(v);
65 return (**this).append(v, check_dup);
74 return (**this).append(v, num_entries);
79 return (**this).findAndRemove(t);
84 return (**this).removeIndex(index);
87 template <
typename...
S>
90 return (**this).emplace_back(
s...);
98 (**this).setCapacity(capacity);
104 T *
data() {
return (**this).data(); }
105 const T *
data()
const {
return (**this).data(); }
116 bool isEmpty()
const {
return (**this).isEmpty(); }
136 template <
typename T>
179 myHandle = std::move(gdh);
194 if (other.myIsStashed)
202 myHandle = other.myHandle;
209 if (other.myIsStashed)
217 myHandle = std::move(other.myHandle);
218 other.myIsStashed =
true;
229 if (other.myIsStashed && myLastModified)
237 else if (other.myIsStashed)
242 myLastModified =
false;
252 myHandle = other.myHandle;
254 myLastModified =
false;
266 if (other.myIsStashed && myLastModified)
274 else if (other.myIsStashed)
279 myLastModified =
false;
292 myHandle = std::move(other.myHandle);
293 other.myIsStashed =
true;
294 myLastModified =
false;
315 myLastModified =
true;
321 if (was_stashed && myHandle.
isNull())
336 utZoneScopedN(
"ApexGeometry::makeUnique::stash::allocateGeoemtry");
341 else if (!for_overwrite)
372 .removePreserveRequest();
381 return *myHandle.
gdpNC();
387 return *getStaticEmpty();
388 return *myHandle.
gdp();
394 return myHandle.
gdpNC();
401 return getStaticEmpty();
402 return myHandle.
gdp();
417 return myHandle.
gdpNC();
440 else if (!for_overwrite)
458 bool force_copy =
false,
462 return *getStaticEmptyHandle();
499 static const HandleInit theEmpty;
500 return &theEmpty.handle;
508 bool myLastModified =
false;
511 bool myIsStashed =
false;
526 const ApexArray<ApexGeometry> &
v);
535 #endif // header guard
ApexGeometry(GU_DetailHandle &&gdh)
Construct an ApexGeometry referencing a GU_DetailHandle.
exint append(const T &v, bool check_dup)
ApexGeometry()
Construct an empty ApexGeometry.
int getPreserveRequest() const
typename UT_Array< T >::const_reverse_iterator const_reverse_iterator
GLenum GLuint GLsizei bufsize
typename UT_Array< T >::reverse_iterator reverse_iterator
GU_Detail * gdpForOverwrite()
bool isValid() const
Determine if this is a valid handle (!isNull())
bool isUnique() const
Returns whether the geometry is unique - if so, asUnsafeHandle can be used safely.
static const UT_COWValue< T > & getStaticEmpty()
size_t UTformatBuffer(char *buffer, size_t bufsize, const ApexArray< T > &v)
const_iterator begin() const
const GU_Detail * gdp() const
GU_ConstDetailHandle asConstHandle(bool force_copy=false, GA_DataIdStrategy explicit_strategy=GA_DATA_ID_CLONE) const
typename UT_Array< T >::iterator iterator
GU_DetailHandle duplicateGeometry(GA_DataIdStrategy data_id_strategy=GA_DATA_ID_BUMP) const
const GU_Detail & operator*() const
Return a const reference to the underlying GU_Detail, without ensuring uniqueness.
void setCapacity(exint capacity)
ApexGeometry(ApexGeometry &&other) noexcept
void allocateAndSet(GU_Detail *gdp, bool own=true)
void addPreserveRequest()
typename UT_Array< T >::const_iterator const_iterator
void setSize(exint newsize)
#define utZoneScopedN(name)
GU_DetailHandle & asUnsafeHandle(bool for_overwrite=false)
const GU_Detail * gdp() const
Access the underlying const GU_Detail, without ensuring uniqueness.
GU_Detail * operator->()
Access the underlying GU_Detail, ensuring uniqueness.
const GU_Detail * peekPtr() const
Access the underlying const GU_Detail *, without ensuring uniqueness.
exint emplace_back(S &&...s)
T & operator[](exint index)
ApexGeometry & operator=(const ApexGeometry &other)
GU_DetailHandle & asSafeHandle()
Access the underlying GU_DetailHandle while first ensuring it is unique.
const GU_Detail * operator->() const
Access the underlying const GU_Detail, without ensuring uniqueness.
ApexGeometry & operator=(ApexGeometry &&other) noexcept
const_iterator rend() const
static APEX_API const ApexGeometry & getStaticEmptyGeometry()
APEX_API size_t UTformatBuffer< ApexGeometry >(char *buffer, size_t bufsize, const ApexArray< ApexGeometry > &v)
void append(const T *v, exint num_entries)
ApexGeometry(const GU_DetailHandle &gdh)
Construct an ApexGeometry referencing a GU_DetailHandle.
GU_Detail & operator*()
Return a reference to the underlying GU_Detail, ensuring uniqueness.
VULKAN_HPP_CONSTEXPR_14 VULKAN_HPP_INLINE T exchange(T &obj, U &&newValue)
const GU_Detail & peek() const
Access the underlying const GU_Detail, without ensuring uniqueness.
const T & operator[](exint index) const
SYS_DECLARE_IS_TR(apex::ApexGeometry)
ApexGeometry(const ApexGeometry &other)
exint find(const T &val, exint start=0) const
const_iterator rbegin() const
void operator=(const UT_Array< T > &other)
static const APEX_COWHandle< T > & getAPEXStaticEmpty()
exint findAndRemove(const T &t)
void removePreserveRequest()
exint removeIndex(exint index)
GU_Detail * gdp()
Access the underlying GU_Detail, ensuring uniqueness.
void makeUnique(bool for_overwrite=false)
const_iterator end() const
const UT_Array< T > & peek() const