aGrUM 2.3.2
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-2025 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-2025 *
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#pragma once
41
42
49
50#ifndef DOXYGEN_SHOULD_SKIP_THIS
51
52namespace gum {
53
54 namespace learning {
55
57 INLINE DBRowGenerator::DBRowGenerator(const std::vector< DBTranslatedValueType >& column_types,
58 const DBRowGeneratorGoal goal) :
59 column_types_(column_types), goal_(goal) {
60 GUM_CONSTRUCTOR(DBRowGenerator);
61 }
62
64 INLINE DBRowGenerator::DBRowGenerator(const DBRowGenerator& from) :
65 nb_remaining_output_rows_(from.nb_remaining_output_rows_),
66 column_types_(from.column_types_), columns_of_interest_(from.columns_of_interest_),
67 goal_(from.goal_) {
68 GUM_CONS_CPY(DBRowGenerator);
69 }
70
72 INLINE DBRowGenerator::DBRowGenerator(DBRowGenerator&& from) :
73 nb_remaining_output_rows_(from.nb_remaining_output_rows_),
74 column_types_(std::move(from.column_types_)),
75 columns_of_interest_(std::move(from.columns_of_interest_)), goal_(from.goal_) {
76 GUM_CONS_MOV(DBRowGenerator);
77 }
78
80 INLINE DBRowGenerator::~DBRowGenerator() { GUM_DESTRUCTOR(DBRowGenerator); }
81
83 INLINE DBRowGenerator& DBRowGenerator::operator=(const DBRowGenerator& from) {
84 nb_remaining_output_rows_ = from.nb_remaining_output_rows_;
85 column_types_ = from.column_types_;
86 columns_of_interest_ = from.columns_of_interest_;
87 goal_ = from.goal_;
88 return *this;
89 }
90
92 INLINE DBRowGenerator& DBRowGenerator::operator=(DBRowGenerator&& from) {
93 nb_remaining_output_rows_ = from.nb_remaining_output_rows_;
94 column_types_ = std::move(from.column_types_);
95 columns_of_interest_ = std::move(from.columns_of_interest_);
96 goal_ = from.goal_;
97 return *this;
98 }
99
101 INLINE bool DBRowGenerator::hasRows() { return nb_remaining_output_rows_ != std::size_t(0); }
102
104 INLINE bool DBRowGenerator::setInputRow(const DBRow< DBTranslatedValue >& row) {
105 nb_remaining_output_rows_ = computeRows_(row);
106 return hasRows();
107 }
108
110 INLINE void DBRowGenerator::decreaseRemainingRows() { --nb_remaining_output_rows_; }
111
113 INLINE void DBRowGenerator::reset() { nb_remaining_output_rows_ = 0; }
114
115 // sets the columns of interest: the output DBRow needs only
116 // contain values fot these columns
117 INLINE void
118 DBRowGenerator::setColumnsOfInterest(const std::vector< std::size_t >& cols_of_interest) {
119 columns_of_interest_ = cols_of_interest;
120 }
121
122 // sets the columns of interest: the output DBRow needs only
123 // contain values fot these columns
124 INLINE void
125 DBRowGenerator::setColumnsOfInterest(std::vector< std::size_t >&& cols_of_interest) {
126 columns_of_interest_ = std::move(cols_of_interest);
127 }
128
130 INLINE const std::vector< std::size_t >& DBRowGenerator::columnsOfInterest() const {
131 return columns_of_interest_;
132 }
133
135 INLINE DBRowGeneratorGoal DBRowGenerator::goal() const { return goal_; }
136
137
138 } /* namespace learning */
139
140} /* namespace gum */
141
142#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:54
gum is the global namespace for all aGrUM entities
Definition agrum.h:46
STL namespace.