SourceXtractorPlusPlus  0.8
Please provide a description of the project.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SimpleSourceGroup.cpp
Go to the documentation of this file.
1 
17 /*
18  * @file SimpleSourceGroup.cpp
19  * @author nikoapos
20  */
21 
23 
24 namespace SourceXtractor {
25 
28 }
29 
32 }
33 
36 }
37 
40 }
41 
43  return const_iterator(std::unique_ptr<IteratorImpl>(new iter{const_cast<SimpleSourceGroup*>(this)->m_sources.begin()}));
44 }
45 
47  return const_iterator(std::unique_ptr<IteratorImpl>(new iter{const_cast<SimpleSourceGroup*>(this)->m_sources.end()}));
48 }
49 
51  m_sources.push_back(source);
52 }
53 
55  iter& iter_impl = dynamic_cast<iter&>(pos.getImpl());
56  auto next_wrapped_it = m_sources.erase(iter_impl.m_wrapped_it);
57  return iterator(std::unique_ptr<IteratorImpl>(new iter{next_wrapped_it}));
58 }
59 
61  auto& other_group = dynamic_cast<const SimpleSourceGroup&>(other);
62  addAllSources(other_group.m_sources);
63 }
64 
65 const Property& SimpleSourceGroup::getProperty(const PropertyId& property_id) const {
66  return m_property_holder.getProperty(property_id);
67 }
68 
70  m_property_holder.setProperty(std::move(property), property_id);
71 }
72 
73 unsigned int SimpleSourceGroup::size() const {
74  return m_sources.size();
75 }
76 
77 } // SourceXtractor namespace
void addSource(std::shared_ptr< SourceInterface > source) override
std::list< std::shared_ptr< SourceInterface > >::iterator m_wrapped_it
unsigned int size() const override
const_iterator cend() override
Base class for all Properties. (has no actual content)
Definition: Property.h:33
iterator removeSource(iterator pos) override
A bare bones implementation of SourceGroupInterface meant to be used to implement unit tests...
void merge(const SourceGroupInterface &other) override
const Property & getProperty(const PropertyId &property_id) const
Returns a reference to a Property if it is set, if not throws a PropertyNotFoundException.
T move(T...args)
Defines the interface used to group sources.
void addAllSources(const SourceCollection &sources)
Convenient method to add all the sources of a collection.
STL class.
Identifier used to set and retrieve properties.
Definition: PropertyId.h:40
GroupIterator< SourceInterface > iterator
const_iterator cbegin() override
const Property & getProperty(const PropertyId &property_id) const override
GroupIterator< const SourceInterface > const_iterator
void setProperty(std::unique_ptr< Property > property, const PropertyId &property_id)
Sets a property, overwriting it if necessary.
std::list< std::shared_ptr< SourceInterface > > m_sources
void setProperty(std::unique_ptr< Property > property, const PropertyId &property_id) override