Medical Imaging Interaction Toolkit  2026.06.00
Medical Imaging Interaction Toolkit
mitk::DataStorageService Class Reference

Default implementation of IDataStorageService. More...

#include <mitkDataStorageService.h>

Inheritance diagram for mitk::DataStorageService:
Collaboration diagram for mitk::DataStorageService:

Public Member Functions

 DataStorageService ()
 Constructor. Creates a default StandaloneDataStorage. More...
 
 ~DataStorageService () override
 Destructor. More...
 
DataStorage::Pointer GetDefaultDataStorage () const override
 
DataStorage::Pointer GetActiveDataStorage () const override
 
DataStorageReference GetActiveDataStorageReference () const override
 
bool SetActiveDataStorage (const std::string &label) override
 
bool AddDataStorage (const std::string &label, DataStorage::Pointer storage) override
 
std::optional< DataStorageReference > CreateDataStorage (const std::string &label) override
 
std::optional< DataStorageReference > GetDataStorageReference (const std::string &label) const override
 
std::optional< std::string > GetLabel (const DataStorage *storage) const override
 
std::vector< std::string > GetAllLabels () const override
 
std::vector< DataStorageReference > GetAllDataStorages () const override
 
bool HasDataStorage (const std::string &label) const override
 
bool RemoveDataStorage (const std::string &label) override
 
StorageThreadDispatcherBase * GetDispatcher () const override
 
void SetDispatcher (StorageThreadDispatcherBase *dispatcher)
 Set the thread dispatcher for DataStorage operations. More...
 
- Public Member Functions inherited from mitk::IDataStorageService
virtual ~IDataStorageService ()
 

Static Public Attributes

static const std::string DEFAULT_LABEL
 The label used for the default DataStorage. More...
 

Detailed Description

Default implementation of IDataStorageService.

This service manages one or more DataStorage instances. A default DataStorage is created on construction.

This class is exported from Core so it can be instantiated by plugins or other code that needs to register the service. The actual service registration is typically done by an activator.

Example usage in a plugin activator:

void MyActivator::start(ctkPluginContext* context)
{
m_DataStorageService = std::make_unique<mitk::DataStorageService>();
auto* moduleContext = us::GetModuleContext();
m_ServiceReg = moduleContext->RegisterService<mitk::IDataStorageService>(m_DataStorageService.get());
}
Service interface for managing DataStorage instances.
static ModuleContext * GetModuleContext()
Returns the module context of the calling module.

Definition at line 50 of file mitkDataStorageService.h.

Constructor & Destructor Documentation

◆ DataStorageService()

mitk::DataStorageService::DataStorageService ( )

Constructor. Creates a default StandaloneDataStorage.

◆ ~DataStorageService()

mitk::DataStorageService::~DataStorageService ( )
override

Destructor.

Member Function Documentation

◆ AddDataStorage()

bool mitk::DataStorageService::AddDataStorage ( const std::string &  label,
DataStorage::Pointer  storage 
)
overridevirtual

◆ CreateDataStorage()

std::optional<DataStorageReference> mitk::DataStorageService::CreateDataStorage ( const std::string &  label)
overridevirtual

◆ GetActiveDataStorage()

DataStorage::Pointer mitk::DataStorageService::GetActiveDataStorage ( ) const
overridevirtual

◆ GetActiveDataStorageReference()

DataStorageReference mitk::DataStorageService::GetActiveDataStorageReference ( ) const
overridevirtual

◆ GetAllDataStorages()

std::vector<DataStorageReference> mitk::DataStorageService::GetAllDataStorages ( ) const
overridevirtual

◆ GetAllLabels()

std::vector<std::string> mitk::DataStorageService::GetAllLabels ( ) const
overridevirtual

◆ GetDataStorageReference()

std::optional<DataStorageReference> mitk::DataStorageService::GetDataStorageReference ( const std::string &  label) const
overridevirtual

◆ GetDefaultDataStorage()

DataStorage::Pointer mitk::DataStorageService::GetDefaultDataStorage ( ) const
overridevirtual

◆ GetDispatcher()

StorageThreadDispatcherBase* mitk::DataStorageService::GetDispatcher ( ) const
overridevirtual

◆ GetLabel()

std::optional<std::string> mitk::DataStorageService::GetLabel ( const DataStorage *  storage) const
overridevirtual

◆ HasDataStorage()

bool mitk::DataStorageService::HasDataStorage ( const std::string &  label) const
overridevirtual

◆ RemoveDataStorage()

bool mitk::DataStorageService::RemoveDataStorage ( const std::string &  label)
overridevirtual

◆ SetActiveDataStorage()

bool mitk::DataStorageService::SetActiveDataStorage ( const std::string &  label)
overridevirtual

◆ SetDispatcher()

void mitk::DataStorageService::SetDispatcher ( StorageThreadDispatcherBase *  dispatcher)

Set the thread dispatcher for DataStorage operations.

This is typically called by activator code that creates this service, injecting a project-specific dispatcher.

Parameters
dispatcherThe dispatcher, or nullptr to clear.

Member Data Documentation

◆ DEFAULT_LABEL

const std::string mitk::DataStorageService::DEFAULT_LABEL
static

The label used for the default DataStorage.

Definition at line 54 of file mitkDataStorageService.h.


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