24 #ifndef PXR_USD_USD_STAGE_CACHE_H
25 #define PXR_USD_USD_STAGE_CACHE_H
32 #include <hboost/lexical_cast.hpp>
110 return FromLongInt(hboost::lexical_cast<long int>(s));
125 explicit operator bool()
const {
return IsValid(); }
134 return !(lhs == rhs);
157 explicit Id(
long int val) : _value(val) {}
217 std::pair<UsdStageRefPtr, bool>
224 UsdStageRefPtr
Find(Id
id)
const;
239 const SdfLayerHandle &sessionLayer)
const;
248 const SdfLayerHandle &rootLayer,
258 const SdfLayerHandle &rootLayer,
259 const SdfLayerHandle &sessionLayer,
265 std::vector<UsdStageRefPtr>
271 std::vector<UsdStageRefPtr>
273 const SdfLayerHandle &sessionLayer)
const;
279 std::vector<UsdStageRefPtr>
288 std::vector<UsdStageRefPtr>
290 const SdfLayerHandle &sessionLayer,
296 Id
GetId(
const UsdStageRefPtr &stage)
const;
300 return static_cast<bool>(
GetId(stage));
310 Id
Insert(
const UsdStageRefPtr &stage);
325 bool Erase(
const UsdStageRefPtr &stage);
332 size_t EraseAll(
const SdfLayerHandle &rootLayer);
339 size_t EraseAll(
const SdfLayerHandle &rootLayer,
340 const SdfLayerHandle &sessionLayer);
348 size_t EraseAll(
const SdfLayerHandle &rootLayer,
349 const SdfLayerHandle &sessionLayer,
375 typedef struct Usd_StageCacheImpl _Impl;
376 std::unique_ptr<_Impl> _impl;
377 mutable std::mutex _mutex;
387 virtual bool IsSatisfiedBy(UsdStageRefPtr
const &stage)
const = 0;
401 void _Subscribe(_Mailbox *);
404 struct _DataDeleter {
void operator()(_Data *); };
405 std::unique_ptr<_Data, _DataDeleter> _data;
411 #endif // PXR_USD_USD_STAGE_CACHE_H
USD_API UsdStageCache()
Default construct an empty cache.
virtual USD_API ~UsdStageCacheRequest()
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)
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 lexical_cast(const std::string &input, T &output)
Integer conversion.
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
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