24 #ifndef PXR_USD_USD_STAGE_CACHE_H
25 #define PXR_USD_USD_STAGE_CACHE_H
109 bool overflow =
false;
113 "'%s' overflowed during conversion to int64_t.",
132 explicit operator bool()
const {
return IsValid(); }
141 return !(lhs == rhs);
164 explicit Id(
long int val) : _value(val) {}
224 std::pair<UsdStageRefPtr, bool>
231 UsdStageRefPtr
Find(Id
id)
const;
246 const SdfLayerHandle &sessionLayer)
const;
255 const SdfLayerHandle &rootLayer,
265 const SdfLayerHandle &rootLayer,
266 const SdfLayerHandle &sessionLayer,
272 std::vector<UsdStageRefPtr>
278 std::vector<UsdStageRefPtr>
280 const SdfLayerHandle &sessionLayer)
const;
286 std::vector<UsdStageRefPtr>
295 std::vector<UsdStageRefPtr>
297 const SdfLayerHandle &sessionLayer,
303 Id
GetId(
const UsdStageRefPtr &stage)
const;
307 return static_cast<bool>(
GetId(stage));
317 Id
Insert(
const UsdStageRefPtr &stage);
332 bool Erase(
const UsdStageRefPtr &stage);
339 size_t EraseAll(
const SdfLayerHandle &rootLayer);
346 size_t EraseAll(
const SdfLayerHandle &rootLayer,
347 const SdfLayerHandle &sessionLayer);
355 size_t EraseAll(
const SdfLayerHandle &rootLayer,
356 const SdfLayerHandle &sessionLayer,
382 typedef struct Usd_StageCacheImpl _Impl;
383 std::unique_ptr<_Impl> _impl;
384 mutable std::mutex _mutex;
394 virtual bool IsSatisfiedBy(UsdStageRefPtr
const &stage)
const = 0;
408 void _Subscribe(_Mailbox *);
411 struct _DataDeleter {
void operator()(_Data *); };
412 std::unique_ptr<_Data, _DataDeleter> _data;
418 #endif // PXR_USD_USD_STAGE_CACHE_H
USD_API UsdStageCache()
Default construct an empty cache.
virtual USD_API ~UsdStageCacheRequest()
TF_API long TfStringToLong(const std::string &txt, bool *outOfRange=NULL)
GLsizei const GLchar *const * string
friend size_t hash_value(Id id)
Hash.
USD_API std::vector< UsdStageRefPtr > GetAllStages() const
Return a vector containing the stages present in this cache.
USD_API std::pair< UsdStageRefPtr, bool > RequestStage(UsdStageCacheRequest &&request)
**But if you need a result
static Id FromString(const std::string &s)
USD_API UsdStageRefPtr Find(Id id) const
USD_API UsdStageRefPtr FindOneMatching(const SdfLayerHandle &rootLayer) const
PXR_NAMESPACE_OPEN_SCOPE SDF_DECLARE_HANDLES(SdfLayer)
bool Contains(Id id) const
Return true if id is present in this cache, false otherwise.
USD_API void SetDebugName(const std::string &debugName)
USD_API bool Erase(Id id)
virtual bool IsSatisfiedBy(UsdStageRefPtr const &stage) const =0
friend void swap(UsdStageCache &lhs, UsdStageCache &rhs)
USD_API size_t Size() const
Return the number of stages present in this cache.
bool IsEmpty() const
Return true if this cache holds no stages, false otherwise.
friend bool operator==(const Id &lhs, const Id &rhs)
Equality comparison.
std::string ToString() const
Convert this Id to a string representation.
USD_API Id GetId(const UsdStageRefPtr &stage) const
std::string TfStringify(const T &v)
bool Contains(const UsdStageRefPtr &stage) const
Return true if stage is present in this cache, false otherwise.
Id()
Default construct an invalid id.
USD_API UsdStageCache & operator=(const UsdStageCache &other)
Replace the contents of this cache with a copy of other.
friend bool operator>(const Id &lhs, const Id &rhs)
Greater-than comparison.
USD_API Id Insert(const UsdStageRefPtr &stage)
USD_API ~UsdStageCache()
Destructor.
static Id FromLongInt(long int val)
friend bool operator>=(const Id &lhs, const Id &rhs)
Greater-than or equal comparison.
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
friend bool operator<(const Id &lhs, const Id &rhs)
Less-than comparison.
USD_API std::vector< UsdStageRefPtr > FindAllMatching(const SdfLayerHandle &rootLayer) const
#define PXR_NAMESPACE_CLOSE_SCOPE
USD_API void swap(UsdStageCache &other)
Swap the contents of this cache with other.
bool IsValid() const
Return true if this Id is valid.
friend bool operator!=(const Id &lhs, const Id &rhs)
Inequality comparison.
virtual UsdStageRefPtr Manufacture()=0
long int ToLongInt() const
Convert this Id to an integral representation.
TF_DECLARE_REF_PTRS(UsdStage)
friend bool operator<=(const Id &lhs, const Id &rhs)
Less-than or equal comparison.
USD_API size_t EraseAll(const SdfLayerHandle &rootLayer)
USD_API std::string GetDebugName() const