STIR 6.4.0
RegisteredObject.h
Go to the documentation of this file.
1//
2//
12/*
13 Copyright (C) 2000-2009, Hammersmith Imanet Ltd
14 This file is part of STIR.
15
16 SPDX-License-Identifier: Apache-2.0
17
18 See STIR/LICENSE.txt for details
19*/
20#ifndef __stir_RegisteredObject_H__
21#define __stir_RegisteredObject_H__
22
26#include <iostream>
27#include <string>
28
29START_NAMESPACE_STIR
30
94template <typename Root>
95class RegisteredObject : public RegisteredObjectBase
96{
97public:
98 inline RegisteredObject();
99
107 inline static Root* read_registered_object(std::istream* in, const std::string& registered_name);
108
110
116 inline static Root* ask_type_and_parameters();
117
119
120 inline static void list_registered_names(std::ostream& stream);
121
122protected:
124 typedef Root* (*RootFactory)(std::istream*);
127
129
133 inline static RegistryType& registry();
134};
135
136END_NAMESPACE_STIR
138
139#endif
Declaration of class stir::FactoryRegistry.
Declaration of class stir::RegisteredObjectBase.
Inline implementations for class stir::RegisteredObject.
This class can be used to store 'factories' and their corresponding keys. It is essentially a map,...
Definition FactoryRegistry.h:53
Base class for all classes that can parse .par files (and more?)The only reason that this class exist...
Definition RegisteredObjectBase.h:41
static Root * ask_type_and_parameters()
ask the user for the type, and then calls read_registered_object(0, type)
Definition RegisteredObject.inl:49
static RegistryType & registry()
Static function returning the registry.
Definition RegisteredObject.inl:33
static void list_registered_names(std::ostream &stream)
List all possible registered names to the stream.
Definition RegisteredObject.inl:59
static Root * read_registered_object(std::istream *in, const std::string &registered_name)
Construct a new object (of a type derived from Root, its actual type determined by the registered_nam...
Definition RegisteredObject.inl:41
FactoryRegistry< std::string, RootFactory, interfile_less > RegistryType
The type of the registry.
Definition RegisteredObject.h:126
Functions useful for manipulating Interfile keywords.