24 #ifndef PXR_USD_SDF_FILE_FORMAT_REGISTRY_H
25 #define PXR_USD_SDF_FILE_FORMAT_REGISTRY_H
30 #include "pxr/base/tf/declarePtrs.h"
31 #include "pxr/base/tf/hash.h"
32 #include "pxr/base/tf/hashmap.h"
33 #include "pxr/base/tf/token.h"
34 #include "pxr/base/tf/type.h"
35 #include "pxr/base/tf/weakBase.h"
36 #include <boost/noncopyable.hpp>
37 #include <boost/shared_ptr.hpp>
42 PXR_NAMESPACE_OPEN_SCOPE
53 class Sdf_FileFormatRegistry : boost::noncopyable
57 Sdf_FileFormatRegistry();
60 SdfFileFormatConstPtr FindById(
const TfToken& formatId);
66 SdfFileFormatConstPtr FindByExtension(
68 const std::string& target = std::string());
72 std::set<std::string> FindAllFileFormatExtensions();
76 TfToken GetPrimaryFormatForExtension(
const std::string& ext);
91 const PlugPluginPtr& plugin)
100 SdfFileFormatRefPtr GetFileFormat()
const;
107 const PlugPluginPtr _plugin;
108 mutable std::mutex _formatMutex;
109 mutable std::atomic<bool> _hasFormat;
110 mutable SdfFileFormatRefPtr _format;
113 typedef boost::shared_ptr<_Info> _InfoSharedPtr;
114 typedef std::vector<_InfoSharedPtr> _InfoSharedPtrVector;
124 std::string, _InfoSharedPtr,
TfHash> _ExtensionIndex;
130 std::string, _InfoSharedPtrVector,
TfHash> _FullExtensionIndex;
134 void _RegisterFormatPlugins();
139 SdfFileFormatConstPtr _GetFileFormat(
const _InfoSharedPtr& format);
141 _FormatInfo _formatInfo;
142 _ExtensionIndex _extensionIndex;
143 _FullExtensionIndex _fullExtensionIndex;
145 std::atomic<bool> _registeredFormatPlugins;
149 PXR_NAMESPACE_CLOSE_SCOPE
151 #endif // PXR_USD_SDF_FILE_FORMAT_REGISTRY_H
#define TF_DECLARE_WEAK_PTRS(type)
Define standard weak pointer types.
Functor to use for hash maps from tokens to other things.
#define TF_DECLARE_WEAK_AND_REF_PTRS(type)
Define standard weak, ref, and vector pointer types.
A user-extensible hashing mechanism for use with runtime hash tables.
Token for efficient comparison, assignment, and hashing of known strings.
Defines an interface to registered plugins.
TfType represents a dynamic runtime type.