STIR  6.2.0
ParseAndCreateFrom.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2019, University College London
3  This file is part of STIR.
4 
5  SPDX-License-Identifier: Apache-2.0
6 
7  See STIR/LICENSE.txt for details
8 */
18 #ifndef __stir_ParseAndCreateFrom_H__
19 #define __stir_ParseAndCreateFrom_H__
20 
23 START_NAMESPACE_STIR
24 
25 class KeyParser;
26 
28 
51 template <class OutputT, class InputT, class ParserT = KeyParser>
53 {
54 public:
56  void set_defaults() {}
58  void add_to_keymap(ParserT&) {}
60  void check_values() const {};
61 
63 
72  OutputT* create(const InputT&) const { return new OutputT(); }
73 };
74 
76 
89 template <class elemT, class ExamDataT>
91 {
92 public:
94  inline output_type* create(const ExamDataT&) const;
95 };
96 
97 END_NAMESPACE_STIR
98 
100 #endif
OutputT * create(const InputT &) const
create a new object
Definition: ParseAndCreateFrom.h:72
void add_to_keymap(ParserT &)
add any relevant parameters to a parser
Definition: ParseAndCreateFrom.h:58
Definition of the stir::ParseDiscretisedDensityParameters class.
template for adding keywords to a parser and creating an object
Definition: ParseAndCreateFrom.h:52
Class for adding parameters relevant to DiscretisedDensity to a parser.
Definition: ParseDiscretisedDensityParameters.h:39
void set_defaults()
set default values for any parameters
Definition: ParseAndCreateFrom.h:56
void check_values() const
should call error() if something is wrong
Definition: ParseAndCreateFrom.h:60
implementation of the stir::ParseAndCreateFrom class for stir:DiscretisedDensity
defines the stir::VoxelsOnCartesianGrid class
This abstract class is the basis for all image representations.
Definition: FBP2DReconstruction.h:35