SourceXtractorPlusPlus 1.0.3
SourceXtractor++, the next generation SExtractor
Loading...
Searching...
No Matches
ExternalFlagTaskFactory.cpp
Go to the documentation of this file.
1
22
24
29
30namespace SourceXtractor {
31
32const char ExternalFlagTaskFactory::propertyName[] = "ExternalFlags";
33
38
39
41 if (m_flag_info_map.find(property_id) != m_flag_info_map.end()) {
42 auto& flag_info = m_flag_info_map.at(property_id);
43
44 // Here we use an ugly switch for choosing the correct type of the task to
45 // instantiate.
46 switch (flag_info.second) {
48 return std::make_shared<ExternalFlagTaskOr>(flag_info.first, property_id.getIndex());
50 return std::make_shared<ExternalFlagTaskAnd>(flag_info.first, property_id.getIndex());
52 return std::make_shared<ExternalFlagTaskMin>(flag_info.first, property_id.getIndex());
54 return std::make_shared<ExternalFlagTaskMax>(flag_info.first, property_id.getIndex());
56 return std::make_shared<ExternalFlagTaskMost>(flag_info.first, property_id.getIndex());
57 }
58 }
59
60 return nullptr;
61}
62
63
65 // Loop through the different flag infos. The i will be the index of the flag property.
66 auto& flag_info_list = manager.getConfiguration<ExternalFlagConfig>().getFlagInfoList();
67 for (unsigned int i = 0; i < flag_info_list.size(); ++i) {
68 auto& pair = flag_info_list.at(i);
69 m_instance_names.emplace_back(pair.first, i);
70 auto property_id = PropertyId::create<ExternalFlag>(i);
71
72 m_flag_info_map[property_id] = pair.second;
73 }
74
75 auto& output_config = manager.getConfiguration<OutputConfig>();
76 auto& output_properties = output_config.getOutputProperties();
77 m_is_output_requested = std::find(output_properties.begin(), output_properties.end(), propertyName)
78 != output_properties.end();
79}
80
84 throw Elements::Exception() << "Requested property ExternalFlag is not configured to produce any output";
85 }
86}
87
88} // SourceXtractor namespace
89
90
91
void registerPropertyInstances(OutputRegistry &) override
void reportConfigDependencies(Euclid::Configuration::ConfigManager &manager) const override
Registers all the Configuration dependencies.
void configure(Euclid::Configuration::ConfigManager &manager) override
Method which should initialize the object.
std::vector< std::pair< std::string, unsigned int > > m_instance_names
std::shared_ptr< Task > createTask(const PropertyId &property_id) const override
Returns a Task producing a Property corresponding to the given PropertyId.
std::map< PropertyId, ExternalFlagConfig::FlagInfo > m_flag_info_map
const std::vector< std::string > getOutputProperties()
void registerPropertyInstances(const std::vector< std::pair< std::string, unsigned int > > &instance_names)
Identifier used to set and retrieve properties.
Definition PropertyId.h:40
static PropertyId create(unsigned int index=0)
Definition PropertyId.h:45
unsigned int getIndex() const
Definition PropertyId.h:70
T find(T... args)
T make_shared(T... args)