7#ifndef PXR_BASE_TF_SCRIPT_MODULE_LOADER_H
8#define PXR_BASE_TF_SCRIPT_MODULE_LOADER_H
12#include "pxr/base/tf/api.h"
15#include "pxr/base/tf/spinRWMutex.h"
22#include "pxr/external/boost/python/dict.hpp"
26#include <unordered_map>
29PXR_NAMESPACE_OPEN_SCOPE
58 std::vector<TfToken>
const &predecessors);
86 _LibInfo(
TfToken const &moduleName,
87 std::vector<TfToken> &&predecessors)
88 : moduleName(moduleName)
89 , predecessors(predecessors) { }
92 std::vector<TfToken> predecessors;
93 mutable std::atomic<bool> isLoaded =
false;
97 std::unordered_map<TfToken, _LibInfo, TfToken::HashFunctor>;
99 using _LibAndInfo = _LibInfoMap::value_type;
104 _LibInfo
const *_FindInfo(
TfToken const &lib)
const;
106 void _LoadLibModules(std::vector<_LibAndInfo const *>
const &toLoad)
const;
108 _LibInfoMap _libInfo;
114PXR_NAMESPACE_CLOSE_SCOPE
Provides low-level facilities for shared libraries with script bindings to register themselves with t...
TF_API void LoadModules()
Load all the script modules for any libraries registered using RegisterLibrary if necessary.
TF_API void LoadModulesForLibrary(TfToken const &name)
Load all the script modules for any libraries registered using RegisterLibrary that depend on library...
static TF_API This & GetInstance()
Return the singleton instance.
TF_API void RegisterLibrary(TfToken const &name, TfToken const &moduleName, std::vector< TfToken > const &predecessors)
Register a library named name and with script module moduleName and libraries which must be loaded fi...
TF_API pxr_boost::python::dict GetModulesDict() const
Return a python dict containing all currently known modules under their canonical names.
TF_API void WriteDotFile(std::string const &file) const
Write a graphviz dot-file for the dependency graph of all currently registered libraries/modules to f...
Manage a single instance of an object (see.
static T & GetInstance()
Return a reference to an object of type T, creating it if necessary.
This class implements a readers-writer spin lock that emphasizes throughput when there is light conte...
Token for efficient comparison, assignment, and hashing of known strings.
Enable a concrete base class for use with TfWeakPtr.
Manage a single instance of an object.
TfToken class for efficient string referencing and hashing, plus conversions to and from stl string c...