A thread-safe, process-global registry that maps codec names to Codec instances.
More...
#include <openvdb/io/Codec.h>
|
| static bool | isRegistered (const std::string &name) |
| | Return true if a codec with the given name has been registered.
|
| static void | registerCodecByName (const std::string &name, Codec::Ptr &&codec) |
| template<typename CodecT> |
| static void | registerCodec () |
| static Codec * | get (const std::string &name) |
| static void | clear () |
| | Deregister all codecs and reset the registry to an empty state.
|
A thread-safe, process-global registry that maps codec names to Codec instances.
Codecs are identified by a unique string name (typically provided by Codec::name()) and stored as Codec::Ptr (i.e. std::unique_ptr<Codec>).
- Typical usage
static void registerCodec()
Definition Codec.h:504
- Note
- Attempting to register a codec whose name is already present throws
openvdb::KeyError. Call isRegistered() first when the caller cannot guarantee uniqueness.
◆ clear()
Deregister all codecs and reset the registry to an empty state.
◆ get()
| Codec * get |
( |
const std::string & | name | ) |
|
|
static |
Return a raw (non-owning) pointer to the codec registered under name, or nullptr if no such codec exists. The returned pointer remains valid for the lifetime of the registry.
◆ isRegistered()
| bool isRegistered |
( |
const std::string & | name | ) |
|
|
static |
Return true if a codec with the given name has been registered.
◆ registerCodec()
template<typename CodecT>
Convenience wrapper that registers CodecT using the name returned by CodecT::name(), constructing the instance internally.
- Exceptions
-
| KeyError | if the codec is already registered. |
◆ registerCodecByName()
| void registerCodecByName |
( |
const std::string & | name, |
|
|
Codec::Ptr && | codec ) |
|
static |
Register a codec under the explicit string name, transferring ownership of codec to the registry.
- Exceptions
-