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

Implementation of the INodeSelectionService interface. More...

#include <mitkNodeSelectionService.h>

Inheritance diagram for mitk::NodeSelectionService:
Collaboration diagram for mitk::NodeSelectionService:

Public Member Functions

 NodeSelectionService ()
 
 ~NodeSelectionService () override
 
bool AddListener (const std::string &context, INodeSelectionListener *listener) override
 Register a listener for selection events in the given context. More...
 
bool RemoveListener (const std::string &context, const INodeSelectionListener *listener) override
 Remove a listener from a specific context. More...
 
bool RemoveListener (const INodeSelectionListener *listener) override
 Remove a listener from all contexts. More...
 
bool SendSelection (const std::string &context, const std::vector< mitk::DataNode::Pointer > &selection) const override
 Send a selection to all listeners registered for the given context. More...
 
- Public Member Functions inherited from mitk::INodeSelectionService
virtual ~INodeSelectionService ()
 Virtual destructor. More...
 

Detailed Description

Implementation of the INodeSelectionService interface.

Provides a thread-safe mechanism for broadcasting DataNode selections to registered listeners within a given context string. Multiple listeners can be registered for the same context. All operations are guarded by a mutex.

See also
INodeSelectionService
INodeSelectionListener

Definition at line 33 of file mitkNodeSelectionService.h.

Constructor & Destructor Documentation

◆ NodeSelectionService()

mitk::NodeSelectionService::NodeSelectionService ( )

◆ ~NodeSelectionService()

mitk::NodeSelectionService::~NodeSelectionService ( )
override

Member Function Documentation

◆ AddListener()

bool mitk::NodeSelectionService::AddListener ( const std::string &  context,
INodeSelectionListener *  listener 
)
overridevirtual

Register a listener for selection events in the given context.

If the listener is already registered for the given context, it is not added again.

Parameters
[in]contextThe selection context identifier. Must not be empty.
[in]listenerThe listener to register. Must not be nullptr.
Returns
true if the arguments are valid, false otherwise.

Implements mitk::INodeSelectionService.

◆ RemoveListener() [1/2]

bool mitk::NodeSelectionService::RemoveListener ( const INodeSelectionListener *  listener)
overridevirtual

Remove a listener from all contexts.

Parameters
[in]listenerThe listener to remove. Must not be nullptr.
Returns
true if at least one registration was removed, false otherwise.

Implements mitk::INodeSelectionService.

◆ RemoveListener() [2/2]

bool mitk::NodeSelectionService::RemoveListener ( const std::string &  context,
const INodeSelectionListener *  listener 
)
overridevirtual

Remove a listener from a specific context.

Parameters
[in]contextThe selection context identifier. Must not be empty.
[in]listenerThe listener to remove. Must not be nullptr.
Returns
true if the listener was found and removed, false otherwise.

Implements mitk::INodeSelectionService.

◆ SendSelection()

bool mitk::NodeSelectionService::SendSelection ( const std::string &  context,
const std::vector< mitk::DataNode::Pointer > &  selection 
) const
overridevirtual

Send a selection to all listeners registered for the given context.

Calls INodeSelectionListener::OnSelectionReceived on each listener registered for the given context.

Parameters
[in]contextThe selection context identifier. Must not be empty.
[in]selectionThe DataNode pointers representing the selection.
Returns
true if the context is non-empty, false otherwise.

Implements mitk::INodeSelectionService.


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