aGrUM  0.14.2
DBRowGeneratorWithBN_tpl.h
Go to the documentation of this file.
1 /***************************************************************************
2  * Copyright (C) 2005 by Christophe GONZALES and Pierre-Henri WUILLEMIN *
3  * {prenom.nom}_at_lip6.fr *
4  * *
5  * This program is free software; you can redistribute it and/or modify *
6  * it under the terms of the GNU General Public License as published by *
7  * the Free Software Foundation; either version 2 of the License, or *
8  * (at your option) any later version. *
9  * *
10  * This program is distributed in the hope that it will be useful, *
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13  * GNU General Public License for more details. *
14  * *
15  * You should have received a copy of the GNU General Public License *
16  * along with this program; if not, write to the *
17  * Free Software Foundation, Inc., *
18  * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
19  ***************************************************************************/
26 
27 #ifndef DOXYGEN_SHOULD_SKIP_THIS
28 
29 namespace gum {
30 
31  namespace learning {
32 
33 
35  template < typename GUM_SCALAR, template < typename > class ALLOC >
39  }
40 
41 
43  template < typename GUM_SCALAR, template < typename > class ALLOC >
45  const std::vector< DBTranslatedValueType, ALLOC< DBTranslatedValueType > >
46  column_types,
47  const BayesNet< GUM_SCALAR >& bn,
48  const DBRowGeneratorGoal goal,
49  const Bijection< NodeId, std::size_t, ALLOC< std::size_t > >&
50  nodeId2columns,
52  alloc) :
53  DBRowGenerator< ALLOC >(column_types, goal, alloc),
54  _bn(&bn), _nodeId2columns(nodeId2columns) {
55  GUM_CONSTRUCTOR(DBRowGeneratorWithBN);
56  }
57 
58 
60  template < typename GUM_SCALAR, template < typename > class ALLOC >
62  const DBRowGeneratorWithBN< GUM_SCALAR, ALLOC >& from,
64  alloc) :
65  DBRowGenerator< ALLOC >(from, alloc),
66  _bn(from._bn), _nodeId2columns(from._nodeId2columns) {
67  GUM_CONS_CPY(DBRowGeneratorWithBN);
68  }
69 
70 
72  template < typename GUM_SCALAR, template < typename > class ALLOC >
74  const DBRowGeneratorWithBN< GUM_SCALAR, ALLOC >& from) :
75  DBRowGeneratorWithBN< GUM_SCALAR, ALLOC >(from, from.getAllocator()) {}
76 
77 
79  template < typename GUM_SCALAR, template < typename > class ALLOC >
81  DBRowGeneratorWithBN< GUM_SCALAR, ALLOC >&& from,
83  alloc) :
84  DBRowGenerator< ALLOC >(std::move(from), alloc),
85  _bn(from._bn), _nodeId2columns(std::move(from._nodeId2columns)) {
86  GUM_CONS_MOV(DBRowGeneratorWithBN);
87  }
88 
89 
91  template < typename GUM_SCALAR, template < typename > class ALLOC >
93  DBRowGeneratorWithBN< GUM_SCALAR, ALLOC >&& from) :
94  DBRowGeneratorWithBN< GUM_SCALAR, ALLOC >(std::move(from),
95  from.getAllocator()) {}
96 
97 
99  template < typename GUM_SCALAR, template < typename > class ALLOC >
101  GUM_DESTRUCTOR(DBRowGeneratorWithBN);
102  }
103 
104 
106  template < typename GUM_SCALAR, template < typename > class ALLOC >
107  DBRowGeneratorWithBN< GUM_SCALAR, ALLOC >&
109  operator=(const DBRowGeneratorWithBN< GUM_SCALAR, ALLOC >& from) {
110  if (this != &from) {
112  _bn = from._bn;
113  _nodeId2columns = from._nodeId2columns;
114  }
115 
116  return *this;
117  }
118 
119 
121  template < typename GUM_SCALAR, template < typename > class ALLOC >
122  DBRowGeneratorWithBN< GUM_SCALAR, ALLOC >&
124  operator=(DBRowGeneratorWithBN< GUM_SCALAR, ALLOC >&& from) {
125  if (this != &from) {
126  DBRowGenerator< ALLOC >::operator=(std::move(from));
127  _bn = from._bn;
128  _nodeId2columns = std::move(from._nodeId2columns);
129  }
130 
131  return *this;
132  }
133 
134 
136  template < typename GUM_SCALAR, template < typename > class ALLOC >
138  const BayesNet< GUM_SCALAR >& new_bn) {
139  _bn = &new_bn;
140  }
141 
142 
144  template < typename GUM_SCALAR, template < typename > class ALLOC >
145  INLINE const BayesNet< GUM_SCALAR >&
147  return *_bn;
148  }
149 
150 
151  } /* namespace learning */
152 
153 } /* namespace gum */
154 
155 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
DBRowGeneratorGoal
the type of things that a DBRowGenerator is designed for
DBRowGenerator< ALLOC > & operator=(const DBRowGenerator< ALLOC > &)
copy constructor
const BayesNet< GUM_SCALAR > * _bn
the Bayesian network used to fill the unobserved values
STL namespace.
gum is the global namespace for all aGrUM entities
Definition: agrum.h:25
DBTranslatedValueType
The nature of the elements handled by translators (discrete, continuous).
allocator_type getAllocator() const
returns the allocator used
DBRowGeneratorWithBN< GUM_SCALAR, ALLOC > & operator=(const DBRowGeneratorWithBN< GUM_SCALAR, ALLOC > &from)
copy operator
Bijection< NodeId, std::size_t, ALLOC< std::size_t > > _nodeId2columns
the mapping betwen the BN&#39;s node ids and the database&#39;s columns
allocator_type getAllocator() const
returns the allocator used
virtual void setBayesNet(const BayesNet< GUM_SCALAR > &new_bn)
assign a new Bayes net to the generator
DBRowGeneratorWithBN(const std::vector< DBTranslatedValueType, ALLOC< DBTranslatedValueType > > column_types, const BayesNet< GUM_SCALAR > &bn, const DBRowGeneratorGoal goal, const Bijection< NodeId, std::size_t, ALLOC< std::size_t > > &nodeId2columns=Bijection< NodeId, std::size_t, ALLOC< std::size_t > >(), const allocator_type &alloc=allocator_type())
default constructor
DBRowGenerator(const std::vector< DBTranslatedValueType, ALLOC< DBTranslatedValueType > > column_types, const DBRowGeneratorGoal goal, const allocator_type &alloc=allocator_type())
default constructor
const BayesNet< GUM_SCALAR > & getBayesNet() const
returns the Bayes net used by the generator
ALLOC< DBTranslatedValue > allocator_type
type for the allocators passed in arguments of methods
A DBRowGenerator class that returns exactly the rows it gets in input.
Size NodeId
Type for node ids.
Definition: graphElements.h:97