Medical Imaging Interaction Toolkit  2024.06.99-60d9b802
Medical Imaging Interaction Toolkit
mitkQuestionFactory.h
Go to the documentation of this file.
1 /*============================================================================
2 
3 The Medical Imaging Interaction Toolkit (MITK)
4 
5 Copyright (c) German Cancer Research Center (DKFZ)
6 All rights reserved.
7 
8 Use of this source code is governed by a 3-clause BSD license that can be
9 found in the LICENSE file.
10 
11 ============================================================================*/
12 
13 #ifndef mitkQuestionFactory_h
14 #define mitkQuestionFactory_h
15 
16 #include <mitkIQuestionFactory.h>
17 
18 #include <memory>
19 #include <string>
20 #include <unordered_map>
21 
22 namespace mitk::Forms
23 {
25  {
26  public:
28  ~QuestionFactory() override;
29 
30  void Register(Question* question) override;
31  Question* Create(const std::string& type) const override;
32 
33  private:
34  std::unordered_map<std::string, std::unique_ptr<Question>> m_Prototypes;
35  };
36 }
37 
38 #endif
mitk::Forms::QuestionFactory::Create
Question * Create(const std::string &type) const override
Create an instance of a Question subclass based on its type string.
mitk::Forms::QuestionFactory
Definition: mitkQuestionFactory.h:24
mitk::Forms::QuestionFactory::~QuestionFactory
~QuestionFactory() override
mitk::Forms
Definition: mitkCheckboxesQuestion.h:18
mitk::Forms::QuestionFactory::Register
void Register(Question *question) override
Register a Question subclass for the instance creation based on its type string.
mitk::Forms::QuestionFactory::QuestionFactory
QuestionFactory()
mitkIQuestionFactory.h
mitk::Forms::Question
Abstract base class for all types of questions used in a Form.
Definition: mitkQuestion.h:31
mitk::Forms::IQuestionFactory
Register subclasses of Question to create instances of them based on their type string.
Definition: mitkIQuestionFactory.h:34