Signet Forge 0.1.0
C++20 Parquet library with AI-native extensions
DEMO
Loading...
Searching...
No Matches
signet::forge::CodecRegistry Class Reference

Thread-safe singleton registry of compression codec implementations. More...

#include <codec.hpp>

Public Member Functions

void register_codec (std::unique_ptr< CompressionCodec > codec)
 Register a codec, transferring ownership to the registry.
 
const CompressionCodecget (Compression type) const
 Look up a registered codec by its Compression type.
 
bool has (Compression type) const
 Check whether a codec is available for the given compression type.
 
std::vector< Compressionavailable () const
 List all available compression types, including UNCOMPRESSED.
 
Deleted copy/move operations (singleton)
 CodecRegistry (const CodecRegistry &)=delete
 
CodecRegistryoperator= (const CodecRegistry &)=delete
 
 CodecRegistry (CodecRegistry &&)=delete
 
CodecRegistryoperator= (CodecRegistry &&)=delete
 

Static Public Member Functions

static CodecRegistryinstance ()
 Access the process-wide singleton instance.
 

Detailed Description

Thread-safe singleton registry of compression codec implementations.

Codecs can be registered from static initializers or at runtime from any thread. All look-up and mutation operations are guarded by an internal mutex. UNCOMPRESSED is handled inline by the convenience functions and is never stored in the registry itself.

Note
Non-copyable and non-movable (singleton pattern).
See also
CompressionCodec, compress(), decompress(), auto_select_compression()

Definition at line 90 of file codec.hpp.

Constructor & Destructor Documentation

◆ CodecRegistry() [1/2]

signet::forge::CodecRegistry::CodecRegistry ( const CodecRegistry )
delete

◆ CodecRegistry() [2/2]

signet::forge::CodecRegistry::CodecRegistry ( CodecRegistry &&  )
delete

Member Function Documentation

◆ available()

std::vector< Compression > signet::forge::CodecRegistry::available ( ) const
inline

List all available compression types, including UNCOMPRESSED.

Returns
A vector containing Compression::UNCOMPRESSED followed by every registered codec type, in unspecified order.

Definition at line 139 of file codec.hpp.

◆ get()

const CompressionCodec * signet::forge::CodecRegistry::get ( Compression  type) const
inline

Look up a registered codec by its Compression type.

Parameters
typeThe Compression enumerator to look up.
Returns
Non-owning pointer to the codec, or nullptr if not registered.
Note
UNCOMPRESSED is not stored in the registry; use the free-standing compress()/decompress() functions which handle it inline.

Definition at line 117 of file codec.hpp.

◆ has()

bool signet::forge::CodecRegistry::has ( Compression  type) const
inline

Check whether a codec is available for the given compression type.

Parameters
typeThe Compression enumerator to query.
Returns
true if the codec is registered, or if type is UNCOMPRESSED (which is always available).

Definition at line 130 of file codec.hpp.

◆ instance()

static CodecRegistry & signet::forge::CodecRegistry::instance ( )
inlinestatic

Access the process-wide singleton instance.

Returns
Reference to the CodecRegistry singleton (Meyers singleton).

Definition at line 94 of file codec.hpp.

◆ operator=() [1/2]

CodecRegistry & signet::forge::CodecRegistry::operator= ( CodecRegistry &&  )
delete

◆ operator=() [2/2]

CodecRegistry & signet::forge::CodecRegistry::operator= ( const CodecRegistry )
delete

◆ register_codec()

void signet::forge::CodecRegistry::register_codec ( std::unique_ptr< CompressionCodec codec)
inline

Register a codec, transferring ownership to the registry.

If a codec for the same Compression type is already registered, the previous one is replaced and destroyed.

Parameters
codecOwning pointer to the codec implementation. Null pointers are silently ignored.

Definition at line 105 of file codec.hpp.


The documentation for this class was generated from the following file: