LoaderRegistry
LoaderRegistry
Registry for managing data format loaders.
#include <LoaderRegistry.hpp>
Public Functions
| Name | |
|---|---|
| LoaderRegistry() =default | |
| ~LoaderRegistry() =default | |
| LoaderRegistry(LoaderRegistry const & ) =delete | |
| LoaderRegistry & | operator=(LoaderRegistry const & ) =delete |
| LoaderRegistry(LoaderRegistry && ) =delete | |
| LoaderRegistry & | operator=(LoaderRegistry && ) =delete |
| void | registerLoader(std::unique_ptr< IFormatLoader > loader) Register a loader plugin. |
| LoadResult | tryLoad(std::string const & format, DM_DataType dataType, std::string const & filepath, nlohmann::json const & config) Try to load data using registered loaders. |
| LoadResult | trySave(std::string const & format, DM_DataType dataType, std::string const & filepath, nlohmann::json const & config, void const * data) Try to save data using registered loaders. |
| bool | isFormatSupported(std::string const & format, DM_DataType dataType) const Check if any registered loader supports the given format/dataType. |
| BatchLoadResult | tryLoadBatch(std::string const & format, DM_DataType dataType, std::string const & filepath, nlohmann::json const & config) Try to load multiple data objects from a single file using batch loading. |
| bool | isBatchLoadingSupported(std::string const & format, DM_DataType dataType) const Check if batch loading is supported for the given format/dataType. |
| std::vector< std::string > | getSupportedFormats(DM_DataType dataType) const Get list of all supported formats for a data type. |
| std::vector< LoaderInfo > | getSupportedLoadFormats() const Query all registered loader capabilities. |
| std::vector< LoaderInfo > | getSupportedLoadFormats(DM_DataType dataType) const Query registered loader capabilities filtered by data type. |
| std::vector< SaverInfo > | getSupportedSaveFormats() const Query all registered saver capabilities. |
| std::vector< SaverInfo > | getSupportedSaveFormats(DM_DataType dataType) const Query registered saver capabilities filtered by data type. |
| LoaderRegistry & | getInstance() Get singleton instance. |
Public Functions Documentation
function LoaderRegistry
LoaderRegistry() =defaultfunction ~LoaderRegistry
~LoaderRegistry() =defaultfunction LoaderRegistry
LoaderRegistry(
LoaderRegistry const &
) =deletefunction operator=
LoaderRegistry & operator=(
LoaderRegistry const &
) =deletefunction LoaderRegistry
LoaderRegistry(
LoaderRegistry &&
) =deletefunction operator=
LoaderRegistry & operator=(
LoaderRegistry &&
) =deletefunction registerLoader
void registerLoader(
std::unique_ptr< IFormatLoader > loader
)Register a loader plugin.
Parameters:
- loader Unique pointer to the loader implementation
function tryLoad
LoadResult tryLoad(
std::string const & format,
DM_DataType dataType,
std::string const & filepath,
nlohmann::json const & config
)Try to load data using registered loaders.
Parameters:
- format Format string from JSON config
- dataType Type of data being loaded
- filepath Path to the file to load
- config Full JSON configuration object
Return: LoadResult with loaded data or error message
Attempts to find a suitable loader for the given format and data type. Returns the first successful load result, or failure if no loader can handle it.
function trySave
LoadResult trySave(
std::string const & format,
DM_DataType dataType,
std::string const & filepath,
nlohmann::json const & config,
void const * data
)Try to save data using registered loaders.
Parameters:
- format Format string from JSON config
- dataType Type of data being saved
- filepath Path where to save the file
- config Full JSON configuration object
- data Pointer to the data object to save
Return: LoadResult indicating success/failure (data field unused)
Attempts to find a suitable loader for the given format and data type that supports saving. Returns the first successful save result, or failure if no loader can handle it.
function isFormatSupported
bool isFormatSupported(
std::string const & format,
DM_DataType dataType
) constCheck if any registered loader supports the given format/dataType.
Parameters:
- format Format string
- dataType Type of data
Return: true if at least one loader supports this combination
function tryLoadBatch
BatchLoadResult tryLoadBatch(
std::string const & format,
DM_DataType dataType,
std::string const & filepath,
nlohmann::json const & config
)Try to load multiple data objects from a single file using batch loading.
Parameters:
- format Format string from JSON config
- dataType Type of data being loaded
- filepath Path to the file to load
- config Full JSON configuration object
Return: BatchLoadResult with all loaded data objects or error message
This method is the preferred way to load files that may contain multiple data objects (e.g., multi-channel binary recordings, multi-series CSV files).
If the loader supports batch loading (supportsBatchLoading() returns true), it will use loadBatch() to get all objects. Otherwise, it falls back to single-object load() wrapped in a BatchLoadResult.
function isBatchLoadingSupported
bool isBatchLoadingSupported(
std::string const & format,
DM_DataType dataType
) constCheck if batch loading is supported for the given format/dataType.
Parameters:
- format Format string
- dataType Type of data
Return: true if at least one loader supports batch loading for this combination
function getSupportedFormats
std::vector< std::string > getSupportedFormats(
DM_DataType dataType
) constGet list of all supported formats for a data type.
Parameters:
- dataType Type of data
Return: Vector of format strings supported for this data type
function getSupportedLoadFormats
std::vector< LoaderInfo > getSupportedLoadFormats() constQuery all registered loader capabilities.
Return: Vector of LoaderInfo from all registered loaders
function getSupportedLoadFormats
std::vector< LoaderInfo > getSupportedLoadFormats(
DM_DataType dataType
) constQuery registered loader capabilities filtered by data type.
Parameters:
- dataType Only return loaders that handle this data type
Return: Filtered vector of LoaderInfo
function getSupportedSaveFormats
std::vector< SaverInfo > getSupportedSaveFormats() constQuery all registered saver capabilities.
Return: Vector of SaverInfo from all registered loaders
function getSupportedSaveFormats
std::vector< SaverInfo > getSupportedSaveFormats(
DM_DataType dataType
) constQuery registered saver capabilities filtered by data type.
Parameters:
- dataType Only return savers that handle this data type
Return: Filtered vector of SaverInfo
function getInstance
static LoaderRegistry & getInstance()Get singleton instance.
Updated on 2026-11-13 at 20:25:40 +0000