aGrUM 3.1.1
a C++ library for (probabilistic) graphical models
DBRowGenerator_inl.h
Go to the documentation of this file.
1/****************************************************************************
2 * This file is part of the aGrUM/pyAgrum library. *
3 * *
4 * Copyright (c) 2005-2026 by *
5 * - Pierre-Henri WUILLEMIN(_at_LIP6) *
6 * - Christophe GONZALES(_at_AMU) *
7 * *
8 * The aGrUM/pyAgrum library is free software; you can redistribute it *
9 * and/or modify it under the terms of either : *
10 * *
11 * - the GNU Lesser General Public License as published by *
12 * the Free Software Foundation, either version 3 of the License, *
13 * or (at your option) any later version, *
14 * - the MIT license (MIT), *
15 * - or both in dual license, as here. *
16 * *
17 * (see https://agrum.gitlab.io/articles/dual-licenses-lgplv3mit.html) *
18 * *
19 * This aGrUM/pyAgrum library is distributed in the hope that it will be *
20 * useful, but WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, *
21 * INCLUDING BUT NOT LIMITED TO THE WARRANTIES MERCHANTABILITY or FITNESS *
22 * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE *
23 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *
24 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, *
25 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR *
26 * OTHER DEALINGS IN THE SOFTWARE. *
27 * *
28 * See LICENCES for more details. *
29 * *
30 * SPDX-FileCopyrightText: Copyright 2005-2026 *
31 * - Pierre-Henri WUILLEMIN(_at_LIP6) *
32 * - Christophe GONZALES(_at_AMU) *
33 * SPDX-License-Identifier: LGPL-3.0-or-later OR MIT *
34 * *
35 * Contact : info_at_agrum_dot_org *
36 * homepage : http://agrum.gitlab.io *
37 * gitlab : https://gitlab.com/agrumery/agrum *
38 * *
39 ****************************************************************************/
40
41#pragma once
42
43
50
51#ifndef DOXYGEN_SHOULD_SKIP_THIS
52
53namespace gum {
54
55 namespace learning {
56
58 INLINE DBRowGenerator::DBRowGenerator(const std::vector< DBTranslatedValueType >& column_types,
59 const DBRowGeneratorGoal goal) :
60 column_types_(column_types), goal_(goal) {
61 GUM_CONSTRUCTOR(DBRowGenerator);
62 }
63
65 INLINE DBRowGenerator::DBRowGenerator(const DBRowGenerator& from) :
66 nb_remaining_output_rows_(from.nb_remaining_output_rows_),
67 column_types_(from.column_types_), columns_of_interest_(from.columns_of_interest_),
68 goal_(from.goal_) {
69 GUM_CONS_CPY(DBRowGenerator);
70 }
71
73 INLINE DBRowGenerator::DBRowGenerator(DBRowGenerator&& from) :
74 nb_remaining_output_rows_(from.nb_remaining_output_rows_),
75 column_types_(std::move(from.column_types_)),
76 columns_of_interest_(std::move(from.columns_of_interest_)), goal_(from.goal_) {
77 GUM_CONS_MOV(DBRowGenerator);
78 }
79
81 INLINE DBRowGenerator::~DBRowGenerator() { GUM_DESTRUCTOR(DBRowGenerator); }
82
84 INLINE DBRowGenerator& DBRowGenerator::operator=(const DBRowGenerator& from) = default;
85
87 INLINE DBRowGenerator& DBRowGenerator::operator=(DBRowGenerator&& from) {
88 nb_remaining_output_rows_ = from.nb_remaining_output_rows_;
89 column_types_ = std::move(from.column_types_);
90 columns_of_interest_ = std::move(from.columns_of_interest_);
91 goal_ = from.goal_;
92 return *this;
93 }
94
96 INLINE bool DBRowGenerator::hasRows() { return nb_remaining_output_rows_ != std::size_t(0); }
97
99 INLINE bool DBRowGenerator::setInputRow(const DBRow< DBTranslatedValue >& row) {
100 nb_remaining_output_rows_ = computeRows_(row);
101 return hasRows();
102 }
103
105 INLINE void DBRowGenerator::decreaseRemainingRows() { --nb_remaining_output_rows_; }
106
108 INLINE void DBRowGenerator::reset() { nb_remaining_output_rows_ = 0; }
109
110 // sets the columns of interest: the output DBRow needs only
111 // contain values fot these columns
112 INLINE void
113 DBRowGenerator::setColumnsOfInterest(const std::vector< std::size_t >& cols_of_interest) {
114 columns_of_interest_ = cols_of_interest;
115 }
116
117 // sets the columns of interest: the output DBRow needs only
118 // contain values fot these columns
119 INLINE void
120 DBRowGenerator::setColumnsOfInterest(std::vector< std::size_t >&& cols_of_interest) {
121 columns_of_interest_ = std::move(cols_of_interest);
122 }
123
125 INLINE const std::vector< std::size_t >& DBRowGenerator::columnsOfInterest() const {
126 return columns_of_interest_;
127 }
128
130 INLINE DBRowGeneratorGoal DBRowGenerator::goal() const { return goal_; }
131
132
133 } /* namespace learning */
134
135} /* namespace gum */
136
137#endif /* DOXYGEN_SHOULD_SKIP_THIS */
The base class for all DBRow generators.
DBRowGenerator(const std::vector< DBTranslatedValueType > &column_types, const DBRowGeneratorGoal goal)
default constructor
DBRowGeneratorGoal
the type of things that a DBRowGenerator is designed for
include the inlined functions if necessary
Definition CSVParser.h:55
gum is the global namespace for all aGrUM entities
Definition agrum.h:46
STL namespace.