2 * @file ElementsExamples/TemplateDataSourceUser.tpp
4 * Created on: Sep 23, 2015
7 * @copyright 2012-2020 Euclid Science Ground Segment
9 * This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General
10 * Public License as published by the Free Software Foundation; either version 3.0 of the License, or (at your option)
13 * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
14 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
17 * You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to
18 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21 #ifndef ELEMENTSEXAMPLES_ELEMENTSEXAMPLES_TEMPLATEDDATASOURCEUSER_IMPL_
22 #error "This file should not be included directly! Use ElementsExamples/TemplatedDataSourceUser.h instead"
25 #include <cstddef> // for std::size_t
31 double TemplatedDataSourceUser::sumRecords(const T& data_source) {
33 std::size_t records_number = data_source.countRecords();
34 for (std::size_t index = 0; index < records_number; ++index) {
35 sum += data_source.getRecordValue(index);
41 } // namespace Examples
42 } // namespace Elements
44 #endif // ELEMENTSEXAMPLES_ELEMENTSEXAMPLES_TEMPLATEDDATASOURCEUSER_IMPL_