SourceXtractorPlusPlus  0.10
Please provide a description of the project.
SimpleSource.h
Go to the documentation of this file.
1 
17 /*
18  * SimpleSource.h
19  *
20  * Created on: Aug 9, 2016
21  * Author: mschefer
22  */
23 
24 #ifndef _SEFRAMEWORK_SOURCE_SIMPLESOURCE_H_
25 #define _SEFRAMEWORK_SOURCE_SIMPLESOURCE_H_
26 
29 
30 namespace SourceXtractor {
31 
41 class SimpleSource : public SourceInterface {
42 
43 public:
44 
46  virtual ~SimpleSource() = default;
47 
48  // removes copy/move constructors and assignment operators
49  SimpleSource(const SimpleSource&) = delete;
50  SimpleSource& operator=(const SimpleSource&) = delete;
51  SimpleSource(SimpleSource&&) = delete;
52  SimpleSource& operator=(SimpleSource&&) = delete;
53 
56 
57  // Note : Because the get/setProperty() methods of the SourceInterface are
58  // templated, the overrides of the non-templated versions will hide them. For
59  // this reason it is necessary to re-introduce the templated methods, which is
60  // done by the using statements below.
63 
64 protected:
65 
66  // Implementation of SourceInterface
67  virtual const Property& getProperty(const PropertyId& property_id) const override {
68  return m_property_holder.getProperty(property_id);
69  }
70 
71  virtual void setProperty(std::unique_ptr<Property> property, const PropertyId& property_id) override {
72  m_property_holder.setProperty(std::move(property), property_id);
73  }
74 
75 private:
77 };
78 
79 }
80 
81 #endif /* _SEFRAMEWORK_SOURCE_SIMPLESOURCE_H_ */
SourceXtractor::SimpleSource::getProperty
virtual const Property & getProperty(const PropertyId &property_id) const override
Definition: SimpleSource.h:67
SourceXtractor::SimpleSource::setProperty
virtual void setProperty(std::unique_ptr< Property > property, const PropertyId &property_id) override
Definition: SimpleSource.h:71
std::move
T move(T... args)
SourceXtractor::Property
Base class for all Properties. (has no actual content)
Definition: Property.h:33
SourceInterface.h
SourceXtractor::PropertyHolder
A class providing a simple implementation of a container of properties.
Definition: PropertyHolder.h:43
SourceXtractor::PropertyHolder::setProperty
void setProperty(std::unique_ptr< Property > property, const PropertyId &property_id)
Sets a property, overwriting it if necessary.
Definition: PropertyHolder.cpp:40
SourceXtractor::PropertyId
Identifier used to set and retrieve properties.
Definition: PropertyId.h:40
SourceXtractor::SimpleSource::m_property_holder
PropertyHolder m_property_holder
Definition: SimpleSource.h:76
SourceXtractor::PropertyHolder::getProperty
const Property & getProperty(const PropertyId &property_id) const
Returns a reference to a Property if it is set, if not throws a PropertyNotFoundException.
Definition: PropertyHolder.cpp:29
SourceXtractor
Definition: Aperture.h:30
SourceXtractor::SimpleSource::~SimpleSource
virtual ~SimpleSource()=default
Destructor.
SourceXtractor::SimpleSource::operator=
SimpleSource & operator=(const SimpleSource &)=delete
SourceXtractor::SimpleSource
A trivial implementation of SourceInterface meant to be used in unit tests.
Definition: SimpleSource.h:41
PropertyHolder.h
SourceXtractor::SourceInterface::getProperty
const PropertyType & getProperty(unsigned int index=0) const
Convenience template method to call getProperty() with a more user-friendly syntax.
Definition: SourceInterface.h:57
SourceXtractor::SimpleSource::SimpleSource
SimpleSource()
Constructor.
Definition: SimpleSource.h:55
SourceXtractor::SourceInterface
The SourceInterface is an abstract "source" that has properties attached to it.
Definition: SourceInterface.h:46
std::unique_ptr
STL class.
SourceXtractor::SourceInterface::setProperty
void setProperty(Args... args)
Definition: SourceInterface.h:72