Common base class for file reader and writer implementations.
More...
#include <mitkFileReaderWriterBase.h>
Common base class for file reader and writer implementations.
Provides shared functionality for file I/O classes, including option management, MIME type handling, service ranking, progress callbacks, and CppMicroServices MIME type registration. This class is used as a common implementation detail by AbstractFileReader and AbstractFileWriter.
- See also
- AbstractFileReader
-
AbstractFileWriter
-
CustomMimeType
Definition at line 39 of file mitkFileReaderWriterBase.h.
◆ Options
◆ ProgressCallback
◆ FileReaderWriterBase() [1/2]
| mitk::FileReaderWriterBase::FileReaderWriterBase |
( |
| ) |
|
◆ ~FileReaderWriterBase()
| virtual mitk::FileReaderWriterBase::~FileReaderWriterBase |
( |
| ) |
|
|
virtual |
◆ FileReaderWriterBase() [2/2]
◆ AddProgressCallback()
| void mitk::FileReaderWriterBase::AddProgressCallback |
( |
const ProgressCallback & |
callback | ) |
|
Register a callback for progress notifications.
- Parameters
-
| [in] | callback | The callback delegate to add. |
◆ GetDefaultOptions()
| Options mitk::FileReaderWriterBase::GetDefaultOptions |
( |
| ) |
const |
Get the default options.
- Returns
- A map of option names to default values.
◆ GetDescription()
| std::string mitk::FileReaderWriterBase::GetDescription |
( |
| ) |
const |
Get the human-readable description of this reader/writer.
- Returns
- The description string.
◆ GetMimeType() [1/2]
Get the associated MIME type (mutable).
- Returns
- Pointer to the CustomMimeType, or nullptr if not set.
◆ GetMimeType() [2/2]
| const CustomMimeType* mitk::FileReaderWriterBase::GetMimeType |
( |
| ) |
const |
Get the associated MIME type (const).
- Returns
- Pointer to the CustomMimeType, or nullptr if not set.
◆ GetMimeTypePrefix()
| std::string mitk::FileReaderWriterBase::GetMimeTypePrefix |
( |
| ) |
const |
Get the prefix used for auto-generated MIME type names.
- Returns
- The MIME type name prefix.
◆ GetOption()
| us::Any mitk::FileReaderWriterBase::GetOption |
( |
const std::string & |
name | ) |
const |
Get the value of a specific option.
Looks up the option first in user-set options, then in defaults.
- Parameters
-
- Returns
- The option value, or an empty us::Any if not found.
◆ GetOptions()
| Options mitk::FileReaderWriterBase::GetOptions |
( |
| ) |
const |
Get all current options merged with defaults.
User-set options override default options. Options not explicitly set fall back to their default values.
- Returns
- A map of all option names to their current or default values.
◆ GetRanking()
| int mitk::FileReaderWriterBase::GetRanking |
( |
| ) |
const |
Get the current service ranking.
- Returns
- The ranking value.
◆ GetRegisteredMimeType()
| MimeType mitk::FileReaderWriterBase::GetRegisteredMimeType |
( |
| ) |
const |
Get the MIME type as registered with the service framework.
If the MIME type has been registered, returns a MimeType object with ranking and service ID. Otherwise, looks up the MIME type by name in the service registry.
- Returns
- The registered MimeType, or an invalid MimeType if not found.
◆ RegisterMimeType()
Register the MIME type as a CppMicroServices service.
If the MIME type name is empty, a synthetic name is generated from the prefix and the first file extension.
- Parameters
-
| [in] | context | The module context for service registration. |
- Returns
- The service registration object.
- Exceptions
-
| std::invalid_argument | if context is nullptr. |
◆ RemoveProgressCallback()
| void mitk::FileReaderWriterBase::RemoveProgressCallback |
( |
const ProgressCallback & |
callback | ) |
|
Remove a previously registered progress callback.
- Parameters
-
| [in] | callback | The callback delegate to remove. |
◆ SetDefaultOptions()
| void mitk::FileReaderWriterBase::SetDefaultOptions |
( |
const Options & |
defaultOptions | ) |
|
Set the default options.
- Parameters
-
| [in] | defaultOptions | A map of option names to default values. |
◆ SetDescription()
| void mitk::FileReaderWriterBase::SetDescription |
( |
const std::string & |
description | ) |
|
Set a human-readable description of this reader/writer.
- Parameters
-
| [in] | description | The description string. |
◆ SetMimeType()
| void mitk::FileReaderWriterBase::SetMimeType |
( |
const CustomMimeType & |
mimeType | ) |
|
Set the MIME type for this reader/writer.
- Parameters
-
◆ SetMimeTypePrefix()
| void mitk::FileReaderWriterBase::SetMimeTypePrefix |
( |
const std::string & |
prefix | ) |
|
Set the prefix used for auto-generated MIME type names.
- Parameters
-
| [in] | prefix | The MIME type name prefix. |
◆ SetOption()
| void mitk::FileReaderWriterBase::SetOption |
( |
const std::string & |
name, |
|
|
const us::Any & |
value |
|
) |
| |
Set a single option value.
Only options known from the default options can be set. Unknown options produce a warning. Passing an empty us::Any resets the option to its default.
- Parameters
-
| [in] | name | The option name. |
| [in] | value | The new value, or empty to reset to default. |
◆ SetOptions()
| void mitk::FileReaderWriterBase::SetOptions |
( |
const Options & |
options | ) |
|
Set multiple options at once.
Each option is validated against the default options. Unknown options are ignored with a warning.
- Parameters
-
| [in] | options | A map of option names to values. |
◆ SetRanking()
| void mitk::FileReaderWriterBase::SetRanking |
( |
int |
ranking | ) |
|
Set the service ranking for this file reader/writer.
Default is zero and should only be chosen differently for a reason. The ranking is used to determine which reader to use if several equivalent readers have been found. It may be used to replace a default reader from MITK in your own project. E.g. if you want to use your own reader for nrrd files instead of the default, implement it and give it a higher ranking than zero.
- Parameters
-
| [in] | ranking | The ranking value. |
◆ UnregisterMimeType()
| void mitk::FileReaderWriterBase::UnregisterMimeType |
( |
| ) |
|
Unregister a previously registered MIME type service.
◆ m_CustomMimeType
| std::unique_ptr<CustomMimeType> mitk::FileReaderWriterBase::m_CustomMimeType |
|
protected |
◆ m_DefaultOptions
| Options mitk::FileReaderWriterBase::m_DefaultOptions |
|
protected |
◆ m_Description
| std::string mitk::FileReaderWriterBase::m_Description |
|
protected |
◆ m_MimeTypePrefix
| std::string mitk::FileReaderWriterBase::m_MimeTypePrefix |
|
protected |
◆ m_MimeTypeReg
◆ m_Options
| Options mitk::FileReaderWriterBase::m_Options |
|
protected |
Options supported by this reader. Set sensible default values!
Can be left empty if no special options are required.
Definition at line 217 of file mitkFileReaderWriterBase.h.
◆ m_ProgressMessage
| Message1<float> mitk::FileReaderWriterBase::m_ProgressMessage |
|
protected |
◆ m_Ranking
| int mitk::FileReaderWriterBase::m_Ranking |
|
protected |
The documentation for this class was generated from the following file: