24{
25 void SampleComposite ::
26 testInvariant () const
27 {
28 for (const auto& sample : m_samples)
29 {
31 }
32 }
33
34
35
36 SampleComposite ::
37 SampleComposite ()
38 : Sample ("unnamed")
39 {
41 }
42
43
44
45 SampleComposite ::
46 SampleComposite (const std::string& name)
48 {
50 }
51
52
53
54 void SampleComposite ::
55 add (std::shared_ptr<Sample> sample)
56 {
60 throw std::runtime_error (
"trying to add sample " +
sample->name() +
" to sample " +
name() +
", which already contains a sample " +
sample->name());
61 m_samples.push_back (std::move (sample));
62 }
63
64
65
66 std::size_t SampleComposite ::
67 getNumFiles () const
68 {
70 throw std::runtime_error ("Sample::numFiles not supported for SampleComposite");
71 }
72
73
74
75 std::string SampleComposite ::
76 getFileName (const std::size_t ) const
77 {
79 throw std::runtime_error ("Sample::fileName not supported for SampleComposite");
80 }
81
82
83
84 std::vector<std::string> SampleComposite ::
85 doMakeFileList () const
86 {
88
89 std::vector<std::string>
result;
90 for (const auto& sample : m_samples)
91 {
92 std::vector<std::string> subresult =
sample->makeFileList();
93 result.insert (
result.end(), subresult.begin(), subresult.end());
94 }
96 }
97
98
99
100 std::unique_ptr<SampleLocal> SampleComposite ::
101 doMakeLocal () const
102 {
104 throw std::runtime_error ("Sample::makeLocal not supported for SampleComposite");
105 }
106
107
108
109 void SampleComposite ::
110 doUpdateLocation (const std::string& from, const std::string& to)
111 {
113 for (const auto& sample : m_samples)
114 {
115 sample->updateLocation (from, to);
116 }
117 }
118
119
120
121 bool SampleComposite ::
122 getContains (const std::string& name) const
123 {
125 for (const auto& sample : m_samples)
126 {
127 if (
sample->contains (name))
128 return true;
129 }
130 return false;
131 }
132
133
134
135 void SampleComposite ::
136 doAddSamples (SampleHandler& result, const std::shared_ptr<Sample>& )
137 {
139 for (auto& sample : m_samples)
140 {
141 sample->addSamples (result, sample);
142 }
143 }
144}
#define RCU_CHANGE_INVARIANT(x)
#define RCU_NEW_INVARIANT(x)
#define RCU_REQUIRE_SOFT(x)
#define RCU_READ_INVARIANT(x)
bool contains(const std::string &s, const std::string ®x)
does a string contain the substring