SourceXtractorPlusPlus
0.8
Please provide a description of the project.
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
SEFramework
SEFramework
Source
SimpleSourceGroup.h
Go to the documentation of this file.
1
17
/*
18
* @file SimpleSourceGroup.h
19
* @author nikoapos
20
*/
21
22
#ifndef _SEFRAMEWORK_SIMPLESOURCEGROUP_H
23
#define _SEFRAMEWORK_SIMPLESOURCEGROUP_H
24
25
#include <list>
26
27
#include "
SEFramework/Source/SourceGroupInterface.h
"
28
#include "
SEFramework/Property/PropertyHolder.h
"
29
30
namespace
SourceXtractor {
31
39
class
SimpleSourceGroup
:
public
SourceGroupInterface
{
40
41
public
:
42
43
virtual
~SimpleSourceGroup
() =
default
;
44
45
iterator
begin
()
override
;
46
47
iterator
end
()
override
;
48
49
const_iterator
cbegin
()
override
;
50
51
const_iterator
cend
()
override
;
52
53
const_iterator
begin
()
const override
;
54
55
const_iterator
end
()
const override
;
56
57
void
addSource
(
std::shared_ptr<SourceInterface>
source)
override
;
58
59
iterator
removeSource
(
iterator
pos)
override
;
60
61
unsigned
int
size
()
const override
;
62
63
void
merge
(
const
SourceGroupInterface
& other)
override
;
64
65
using
SourceInterface::getProperty
;
66
using
SourceInterface::setProperty
;
67
68
protected
:
69
70
const
Property
&
getProperty
(
const
PropertyId
& property_id)
const override
;
71
72
void
setProperty
(
std::unique_ptr<Property>
property,
const
PropertyId
& property_id)
override
;
73
74
private
:
75
76
class
iter
;
77
std::list<std::shared_ptr<SourceInterface>
>
m_sources
;
78
PropertyHolder
m_property_holder
;
79
80
};
/* End of SimpleSourceGroup class */
81
82
83
class
SimpleSourceGroup::iter
:
public
SourceGroupInterface::IteratorImpl
{
84
85
public
:
86
iter
(
std::list
<
std::shared_ptr<SourceInterface>
>::
iterator
wrapped_it)
87
:
m_wrapped_it
(wrapped_it) {
88
}
89
90
virtual
~iter
() =
default
;
91
92
SourceInterface
&
dereference
()
const override
{
93
return
const_cast<
SourceInterface
&
>
(**m_wrapped_it);
94
}
95
96
void
increment
()
override
{
97
++
m_wrapped_it
;
98
}
99
100
void
decrement
()
override
{
101
--
m_wrapped_it
;
102
}
103
104
bool
equal
(
const
IteratorImpl
& other)
const override
{
105
try
{
106
auto
& other_iter =
dynamic_cast<
const
iter
&
>
(other);
107
return
this->
m_wrapped_it
== other_iter.m_wrapped_it;
108
}
catch
(...) {
109
return
false
;
110
}
111
}
112
113
std::shared_ptr<IteratorImpl>
clone
()
const override
{
114
return
std::make_shared<iter>(
m_wrapped_it
);
115
}
116
117
118
private
:
119
120
std::list<std::shared_ptr<SourceInterface>
>
::iterator
m_wrapped_it
;
121
122
friend
SimpleSourceGroup::iterator
SimpleSourceGroup::removeSource
(
SimpleSourceGroup::iterator
);
123
124
};
125
126
}
/* namespace SourceXtractor */
127
128
#endif
/* _SEFRAMEWORK_SIMPLESOURCEGROUP_H */
129
std::shared_ptr
SourceXtractor::SimpleSourceGroup::iter::equal
bool equal(const IteratorImpl &other) const override
Definition:
SimpleSourceGroup.h:104
SourceXtractor::SimpleSourceGroup::addSource
void addSource(std::shared_ptr< SourceInterface > source) override
Definition:
SimpleSourceGroup.cpp:50
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::SimpleSourceGroup::~SimpleSourceGroup
virtual ~SimpleSourceGroup()=default
SourceXtractor::SimpleSourceGroup::iter::iter
iter(std::list< std::shared_ptr< SourceInterface >>::iterator wrapped_it)
Definition:
SimpleSourceGroup.h:86
SourceXtractor::SimpleSourceGroup::iter::dereference
SourceInterface & dereference() const override
Definition:
SimpleSourceGroup.h:92
std::iterator
SourceXtractor::SimpleSourceGroup::iter::m_wrapped_it
std::list< std::shared_ptr< SourceInterface > >::iterator m_wrapped_it
Definition:
SimpleSourceGroup.h:120
SourceXtractor::SimpleSourceGroup::size
unsigned int size() const override
Definition:
SimpleSourceGroup.cpp:73
SourceXtractor::SimpleSourceGroup::m_property_holder
PropertyHolder m_property_holder
Definition:
SimpleSourceGroup.h:78
SourceXtractor::SimpleSourceGroup::cend
const_iterator cend() override
Definition:
SimpleSourceGroup.cpp:38
SourceGroupInterface.h
SourceXtractor::Property
Base class for all Properties. (has no actual content)
Definition:
Property.h:33
SourceXtractor::SimpleSourceGroup::removeSource
iterator removeSource(iterator pos) override
Definition:
SimpleSourceGroup.cpp:54
SourceXtractor::SourceInterface::setProperty
void setProperty(Args...args)
Definition:
SourceInterface.h:72
SourceXtractor::SimpleSourceGroup
A bare bones implementation of SourceGroupInterface meant to be used to implement unit tests...
Definition:
SimpleSourceGroup.h:39
SourceXtractor::SourceGroupInterface::GroupIterator
Definition:
SourceGroupInterface.h:51
SourceXtractor::SimpleSourceGroup::end
iterator end() override
Definition:
SimpleSourceGroup.cpp:30
SourceXtractor::SimpleSourceGroup::merge
void merge(const SourceGroupInterface &other) override
Definition:
SimpleSourceGroup.cpp:60
SourceXtractor::SimpleSourceGroup::begin
iterator begin() override
Definition:
SimpleSourceGroup.cpp:26
std::list
STL class.
SourceXtractor::SourceGroupInterface
Defines the interface used to group sources.
Definition:
SourceGroupInterface.h:37
std::unique_ptr
STL class.
SourceXtractor::PropertyId
Identifier used to set and retrieve properties.
Definition:
PropertyId.h:40
SourceXtractor::SimpleSourceGroup::iter::~iter
virtual ~iter()=default
SourceXtractor::SimpleSourceGroup::cbegin
const_iterator cbegin() override
Definition:
SimpleSourceGroup.cpp:34
SourceXtractor::SimpleSourceGroup::getProperty
const Property & getProperty(const PropertyId &property_id) const override
Definition:
SimpleSourceGroup.cpp:65
PropertyHolder.h
SourceXtractor::PropertyHolder
A class providing a simple implementation of a container of properties.
Definition:
PropertyHolder.h:43
SourceXtractor::SimpleSourceGroup::iter::decrement
void decrement() override
Definition:
SimpleSourceGroup.h:100
SourceXtractor::SimpleSourceGroup::m_sources
std::list< std::shared_ptr< SourceInterface > > m_sources
Definition:
SimpleSourceGroup.h:76
SourceXtractor::SimpleSourceGroup::iter::increment
void increment() override
Definition:
SimpleSourceGroup.h:96
SourceXtractor::SourceInterface
The SourceInterface is an abstract "source" that has properties attached to it.
Definition:
SourceInterface.h:46
SourceXtractor::SimpleSourceGroup::iter::clone
std::shared_ptr< IteratorImpl > clone() const override
Definition:
SimpleSourceGroup.h:113
SourceXtractor::SimpleSourceGroup::iter
Definition:
SimpleSourceGroup.h:83
SourceXtractor::SourceGroupInterface::IteratorImpl
Definition:
SourceGroupInterface.h:89
SourceXtractor::SimpleSourceGroup::setProperty
void setProperty(std::unique_ptr< Property > property, const PropertyId &property_id) override
Definition:
SimpleSourceGroup.cpp:69
Generated by
1.8.5