7 #ifndef PXR_USD_USD_STAGE_CACHE_H
8 #define PXR_USD_USD_STAGE_CACHE_H
92 bool overflow =
false;
96 "'%s' overflowed during conversion to int64_t.",
124 return !(lhs == rhs);
147 explicit Id(
long int val) : _value(val) {}
207 std::pair<UsdStageRefPtr, bool>
214 UsdStageRefPtr
Find(Id
id)
const;
229 const SdfLayerHandle &sessionLayer)
const;
238 const SdfLayerHandle &rootLayer,
248 const SdfLayerHandle &rootLayer,
249 const SdfLayerHandle &sessionLayer,
255 std::vector<UsdStageRefPtr>
261 std::vector<UsdStageRefPtr>
263 const SdfLayerHandle &sessionLayer)
const;
269 std::vector<UsdStageRefPtr>
278 std::vector<UsdStageRefPtr>
280 const SdfLayerHandle &sessionLayer,
286 Id
GetId(
const UsdStageRefPtr &stage)
const;
290 return static_cast<bool>(
GetId(stage));
300 Id
Insert(
const UsdStageRefPtr &stage);
315 bool Erase(
const UsdStageRefPtr &stage);
322 size_t EraseAll(
const SdfLayerHandle &rootLayer);
329 size_t EraseAll(
const SdfLayerHandle &rootLayer,
330 const SdfLayerHandle &sessionLayer);
338 size_t EraseAll(
const SdfLayerHandle &rootLayer,
339 const SdfLayerHandle &sessionLayer,
365 typedef struct Usd_StageCacheImpl _Impl;
366 std::unique_ptr<_Impl> _impl;
367 mutable std::mutex _mutex;
377 virtual bool IsSatisfiedBy(UsdStageRefPtr
const &stage)
const = 0;
391 void _Subscribe(_Mailbox *);
394 struct _DataDeleter {
void operator()(_Data *); };
395 std::unique_ptr<_Data, _DataDeleter> _data;
401 #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)
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