SourceXtractorPlusPlus 0.21
SourceXtractor++, the next generation SExtractor
Loading...
Searching...
No Matches
TaskFactoryRegistry.h
Go to the documentation of this file.
1
17/*
18 * TaskFactoryRegistry.h
19 *
20 * Created on: Aug 2, 2016
21 * Author: mschefer
22 */
23
24#ifndef _SEFRAMEWORK_TASK_TASKFACTORYREGISTRY_H_
25#define _SEFRAMEWORK_TASK_TASKFACTORYREGISTRY_H_
26
27#include <memory>
28#include <vector>
29#include <unordered_map>
30#include <unordered_set>
31
33
34namespace SourceXtractor {
35
36class OutputRegistry;
37class TaskFactory;
38
40public:
41
44 public:
45 DuplicateFactoryException() : Elements::Exception("Duplicate PropertyId in TaskProvider") {}
46 };
47
48 virtual ~TaskFactoryRegistry() = default;
49
50 template<typename FactoryType, typename... Ts>
58
62
63 // Configurable interface
66
67 void registerPropertyInstances(OutputRegistry& output_registry);
68
69private:
70 template<typename T>
72 auto type_index = std::type_index(typeid(T));
73 // if we already have a factory for a property_id, throw an exception
76 }
78 }
79
80 template<typename T, typename T2, typename... Ts>
85
88};
89
90}
91
92
93
94#endif /* _SEFRAMEWORK_TASK_TASKFACTORYREGISTRY_H_ */
Exception(ExitCode e=ExitCode::NOT_OK)
Interface of objects which can be configured.
Exception raised when trying to register 2 TaskFactories that produce the same PropertyType.
virtual ~TaskFactoryRegistry()=default
std::unordered_set< std::shared_ptr< TaskFactory > > m_task_factories
void registerTaskFactoryImpl(std::shared_ptr< TaskFactory > task_factory)
void configure(Euclid::Configuration::ConfigManager &manager) override
Method which should initialize the object.
void registerTaskFactoryImpl(std::shared_ptr< TaskFactory > task_factory)
void registerPropertyInstances(OutputRegistry &output_registry)
void reportConfigDependencies(Euclid::Configuration::ConfigManager &manager) const override
Registers all the Configuration dependencies.
const TaskFactory & getFactory(std::type_index type_id) const
std::unordered_map< std::type_index, std::shared_ptr< TaskFactory > > m_type_task_factories_map
Creates a Task for computing a given property.
Definition TaskFactory.h:42