aGrUM 2.3.2
a C++ library for (probabilistic) graphical models
DBRowGeneratorWithBN_tpl.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 template < typename GUM_SCALAR >
59 const std::vector< DBTranslatedValueType >& column_types,
60 const BayesNet< GUM_SCALAR >& bn,
61 const DBRowGeneratorGoal goal,
62 const Bijection< NodeId, std::size_t >& nodeId2columns) :
63 DBRowGenerator(column_types, goal), bn_(&bn), nodeId2columns_(nodeId2columns) {
64 GUM_CONSTRUCTOR(DBRowGeneratorWithBN);
65 }
66
68 template < typename GUM_SCALAR >
69 DBRowGeneratorWithBN< GUM_SCALAR >::DBRowGeneratorWithBN(
70 const DBRowGeneratorWithBN< GUM_SCALAR >& from) :
71 DBRowGenerator(from), bn_(from.bn_), nodeId2columns_(from.nodeId2columns_) {
72 GUM_CONS_CPY(DBRowGeneratorWithBN);
73 }
74
76 template < typename GUM_SCALAR >
77 DBRowGeneratorWithBN< GUM_SCALAR >::DBRowGeneratorWithBN(
78 DBRowGeneratorWithBN< GUM_SCALAR >&& from) :
79 DBRowGenerator(std::move(from)), bn_(from.bn_),
80 nodeId2columns_(std::move(from.nodeId2columns_)) {
81 GUM_CONS_MOV(DBRowGeneratorWithBN);
82 }
83
85 template < typename GUM_SCALAR >
86 DBRowGeneratorWithBN< GUM_SCALAR >::~DBRowGeneratorWithBN() {
87 GUM_DESTRUCTOR(DBRowGeneratorWithBN);
88 }
89
91 template < typename GUM_SCALAR >
92 DBRowGeneratorWithBN< GUM_SCALAR >& DBRowGeneratorWithBN< GUM_SCALAR >::operator=(
93 const DBRowGeneratorWithBN< GUM_SCALAR >& from) {
94 if (this != &from) {
95 DBRowGenerator::operator=(from);
96 bn_ = from.bn_;
97 nodeId2columns_ = from.nodeId2columns_;
98 }
99
100 return *this;
101 }
102
104 template < typename GUM_SCALAR >
105 DBRowGeneratorWithBN< GUM_SCALAR >&
106 DBRowGeneratorWithBN< GUM_SCALAR >::operator=(DBRowGeneratorWithBN< GUM_SCALAR >&& from) {
107 if (this != &from) {
108 DBRowGenerator::operator=(std::move(from));
109 bn_ = from.bn_;
110 nodeId2columns_ = std::move(from.nodeId2columns_);
111 }
112
113 return *this;
114 }
115
117 template < typename GUM_SCALAR >
118 INLINE void
119 DBRowGeneratorWithBN< GUM_SCALAR >::setBayesNet(const BayesNet< GUM_SCALAR >& new_bn) {
120 bn_ = &new_bn;
121 }
122
124 template < typename GUM_SCALAR >
125 INLINE const BayesNet< GUM_SCALAR >& DBRowGeneratorWithBN< GUM_SCALAR >::getBayesNet() const {
126 return *bn_;
127 }
128
129
130 } /* namespace learning */
131
132} /* namespace gum */
133
134#endif /* DOXYGEN_SHOULD_SKIP_THIS */
A DBRowGenerator class that returns exactly the rows it gets in input.
DBRowGeneratorWithBN(const std::vector< DBTranslatedValueType > &column_types, const BayesNet< GUM_SCALAR > &bn, const DBRowGeneratorGoal goal, const Bijection< NodeId, std::size_t > &nodeId2columns=Bijection< NodeId, std::size_t >())
default constructor
The base class for all DBRow generators.
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.