GCC Code Coverage Report


Directory: ./
File: include/pdcom5/Selector.h
Date: 2024-03-27 13:09:52
Exec Total Coverage
Lines: 5 5 100.0%
Branches: 0 0 -%

Line Branch Exec Source
1 /*****************************************************************************
2 * vim:tw=78
3 *
4 * Copyright (C) 2021 Richard Hacker (lerichi at gmx dot net),
5 * Florian Pose (fp at igh dot de),
6 * Bjarne von Horn (vh at igh dot de).
7 *
8 * This file is part of the PdCom library.
9 *
10 * The PdCom library is free software: you can redistribute it and/or modify
11 * it under the terms of the GNU Lesser General Public License as published by
12 * the Free Software Foundation, either version 3 of the License, or (at your
13 * option) any later version.
14 *
15 * The PdCom library is distributed in the hope that it will be useful, but
16 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
17 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
18 * License for more details.
19 *
20 * You should have received a copy of the GNU Lesser General Public License
21 * along with the PdCom library. If not, see <http://www.gnu.org/licenses/>.
22 *
23 *****************************************************************************/
24
25 /** @file */
26
27 #ifndef PDCOM5_SELECTOR_H
28 #define PDCOM5_SELECTOR_H
29
30 #include "SizeTypeInfo.h"
31
32 #include <memory>
33 #include <pdcom5_export.h>
34 #include <vector>
35
36 namespace PdCom {
37 namespace impl {
38 struct Selector;
39 } // namespace impl
40 class Variable;
41
42
43 /** Selector base class for creating views on multidimensional data.
44 *
45 * Developers have to derive from impl::Selector to define new views.
46 */
47 158 struct PDCOM5_PUBLIC Selector
48 {
49 std::shared_ptr<const impl::Selector> impl_;
50
51 Selector();
52 57 Selector(std::shared_ptr<const impl::Selector> impl) :
53 57 impl_(std::move(impl))
54 57 {}
55
56 SizeInfo getViewSizeInfo(const Variable &variable) const;
57 };
58
59 /** Selects one scalar out of a vector or matrix.
60 *
61 * The index is in Row major format, ((layer, )row, column).
62 */
63 6 struct PDCOM5_PUBLIC ScalarSelector : Selector
64 {
65 ScalarSelector(std::vector<int> indices);
66 };
67
68
69 } // namespace PdCom
70
71 #endif // PDCOM5_SELECTOR_H
72