Medical Imaging Interaction Toolkit  2026.06.00
Medical Imaging Interaction Toolkit
mitk::Forms::QuestionFactory Class Reference

Default implementation of IQuestionFactory using prototype-based creation. More...

#include <mitkQuestionFactory.h>

Inheritance diagram for mitk::Forms::QuestionFactory:
Collaboration diagram for mitk::Forms::QuestionFactory:

Public Member Functions

 QuestionFactory ()
 
 ~QuestionFactory () override
 
void Register (Question *question) override
 Register a question prototype. Takes ownership of the pointer. More...
 
Question * Create (const std::string &type) const override
 Create a new question instance by cloning the registered prototype for the given type. More...
 
- Public Member Functions inherited from mitk::Forms::IQuestionFactory
virtual ~IQuestionFactory ()
 Virtual destructor. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from mitk::Forms::IQuestionFactory
static IQuestionFactory * GetInstance ()
 Obtain a pointer to the single instance of this service. More...
 

Detailed Description

Default implementation of IQuestionFactory using prototype-based creation.

Stores question prototypes keyed by their type string and creates new instances by cloning the matching prototype.

Definition at line 30 of file mitkQuestionFactory.h.

Constructor & Destructor Documentation

◆ QuestionFactory()

mitk::Forms::QuestionFactory::QuestionFactory ( )

◆ ~QuestionFactory()

mitk::Forms::QuestionFactory::~QuestionFactory ( )
override

Member Function Documentation

◆ Create()

Question* mitk::Forms::QuestionFactory::Create ( const std::string &  type) const
overridevirtual

Create a new question instance by cloning the registered prototype for the given type.

Parameters
typeThe question type string.
Returns
A new Question instance, or nullptr if no prototype is registered for this type.

Implements mitk::Forms::IQuestionFactory.

◆ Register()

void mitk::Forms::QuestionFactory::Register ( Question *  question)
overridevirtual

Register a question prototype. Takes ownership of the pointer.

Parameters
questionThe prototype question to register. Its type string is used as the key.

Implements mitk::Forms::IQuestionFactory.


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