aGrUM 3.1.1
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-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#include <agrum/base/database/DBRowGeneratorWithBN.h> // to ease IDE parser
51
52#ifndef DOXYGEN_SHOULD_SKIP_THIS
53
54namespace gum {
55
56 namespace learning {
57
59 template < GUM_Numeric GUM_SCALAR >
61 const std::vector< DBTranslatedValueType >& column_types,
62 const BayesNet< GUM_SCALAR >& bn,
63 const DBRowGeneratorGoal goal,
64 const Bijection< NodeId, std::size_t >& nodeId2columns) :
65 DBRowGenerator(column_types, goal), bn_(&bn), nodeId2columns_(nodeId2columns) {
66 GUM_CONSTRUCTOR(DBRowGeneratorWithBN);
67 }
68
70 template < GUM_Numeric GUM_SCALAR >
71 DBRowGeneratorWithBN< GUM_SCALAR >::DBRowGeneratorWithBN(
72 const DBRowGeneratorWithBN< GUM_SCALAR >& from) :
73 DBRowGenerator(from), bn_(from.bn_), nodeId2columns_(from.nodeId2columns_) {
74 GUM_CONS_CPY(DBRowGeneratorWithBN);
75 }
76
78 template < GUM_Numeric GUM_SCALAR >
79 DBRowGeneratorWithBN< GUM_SCALAR >::DBRowGeneratorWithBN(
80 DBRowGeneratorWithBN< GUM_SCALAR >&& from) :
81 DBRowGenerator(std::move(from)), bn_(from.bn_),
82 nodeId2columns_(std::move(from.nodeId2columns_)) {
83 GUM_CONS_MOV(DBRowGeneratorWithBN);
84 }
85
87 template < GUM_Numeric GUM_SCALAR >
88 DBRowGeneratorWithBN< GUM_SCALAR >::~DBRowGeneratorWithBN() {
89 GUM_DESTRUCTOR(DBRowGeneratorWithBN);
90 }
91
93 template < GUM_Numeric GUM_SCALAR >
94 DBRowGeneratorWithBN< GUM_SCALAR >& DBRowGeneratorWithBN< GUM_SCALAR >::operator=(
95 const DBRowGeneratorWithBN< GUM_SCALAR >& from) {
96 if (this != &from) {
97 DBRowGenerator::operator=(from);
98 bn_ = from.bn_;
99 nodeId2columns_ = from.nodeId2columns_;
100 }
101
102 return *this;
103 }
104
106 template < GUM_Numeric GUM_SCALAR >
107 DBRowGeneratorWithBN< GUM_SCALAR >&
108 DBRowGeneratorWithBN< GUM_SCALAR >::operator=(DBRowGeneratorWithBN< GUM_SCALAR >&& from) {
109 if (this != &from) {
110 DBRowGenerator::operator=(std::move(from));
111 bn_ = from.bn_;
112 nodeId2columns_ = std::move(from.nodeId2columns_);
113 }
114
115 return *this;
116 }
117
119 template < GUM_Numeric GUM_SCALAR >
120 void DBRowGeneratorWithBN< GUM_SCALAR >::setBayesNet(const BayesNet< GUM_SCALAR >& new_bn) {
121 bn_ = &new_bn;
122 }
123
125 template < GUM_Numeric GUM_SCALAR >
126 const BayesNet< GUM_SCALAR >& DBRowGeneratorWithBN< GUM_SCALAR >::getBayesNet() const {
127 return *bn_;
128 }
129
130
131 } /* namespace learning */
132
133} /* namespace gum */
134
135#endif /* DOXYGEN_SHOULD_SKIP_THIS */
A DBRowGenerator class that returns exactly the rows it gets in input.
Base class for DBRowGenerator classes that use a BN for computing their outputs.
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:55
gum is the global namespace for all aGrUM entities
Definition agrum.h:46
STL namespace.