SourceXtractorPlusPlus 0.19.2
SourceXtractor++, the next generation SExtractor
Loading...
Searching...
No Matches
SourceGroupWithOnDemandProperties.cpp
Go to the documentation of this file.
1
25
26namespace SourceXtractor {
27
31
35
39
43
47
51
55
60
66
69 // We go through the EntangledSources of the other group and we create new ones
70 // locally, pointing to the same wrapped sources. This is necessary, so the
71 // new EntangledSources have a reference to the correct group.
72 for (auto& source : other_group.m_sources) {
73 auto& entangled_source = dynamic_cast<EntangledSource&>(source.getRef());
74 m_sources.emplace_back(Euclid::make_unique<EntangledSource>(std::move(entangled_source.m_source), *this));
75 }
76 other_group.m_sources.clear();
78}
79
81 // If we already have the property, return it
84 }
85
86 // If not, get the task for that property, use it to compute the property then return it
87 auto task = m_task_provider->getTask<GroupTask>(property_id);
88 if (task) {
89 task->computeProperties(const_cast<SourceGroupWithOnDemandProperties&>(*this));
91 }
92
93 // No task available to make that property, we throw an exception
95}
96
100
107
109 return m_sources.size();
110}
111
112} // SourceXtractor namespace
113
114
115
T begin(T... args)
A Task that acts on a SourceGroup to compute one or more properties.
Definition GroupTask.h:36
bool isPropertySet(const PropertyId &property_id) const
Returns true if the property is set.
const Property & getProperty(const PropertyId &property_id) const
Returns a reference to a Property if it is set, if not throws a PropertyNotFoundException.
void setProperty(std::unique_ptr< Property > property, const PropertyId &property_id)
Sets a property, overwriting it if necessary.
Identifier used to set and retrieve properties.
Definition PropertyId.h:40
An exception indicating that a Property was not available and could not be computed on demand.
Base class for all Properties. (has no actual content)
Definition Property.h:33
Defines the interface used to group sources.
std::list< SourceWrapper >::const_iterator const_iterator
std::list< SourceWrapper >::iterator iterator
A SourceGroupInterface implementation which used a TaskProvider to compute missing properties.
SourceGroupWithOnDemandProperties(std::shared_ptr< TaskProvider > task_provider)
const Property & getProperty(const PropertyId &property_id) const override
void setProperty(std::unique_ptr< Property > property, const PropertyId &property_id) override
void addSource(std::unique_ptr< SourceInterface > source) override
T emplace_back(T... args)
T end(T... args)
T erase(T... args)
T move(T... args)
T size(T... args)