aGrUM  0.20.3
a C++ library for (probabilistic) graphical models
DBRowGenerator_tpl.h
Go to the documentation of this file.
1 /**
2  *
3  * Copyright (c) 2005-2021 by Pierre-Henri WUILLEMIN(@LIP6) & Christophe GONZALES(@AMU)
4  * info_at_agrum_dot_org
5  *
6  * This library is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU Lesser General Public License as published by
8  * the Free Software Foundation, either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public License
17  * along with this library. If not, see <http://www.gnu.org/licenses/>.
18  *
19  */
20 
21 
22 /** @file
23  * @brief Template implementation of DBRowGenerator
24  *
25  * @author Christophe GONZALES(@AMU) and Pierre-Henri WUILLEMIN(@LIP6)
26  */
27 #include <agrum/tools/database/DBRowGenerator.h>
28 
29 #ifndef DOXYGEN_SHOULD_SKIP_THIS
30 
31 namespace gum {
32 
33  namespace learning {
34 
35  /// default constructor
36  template < template < typename > class ALLOC >
37  DBRowGenerator< ALLOC >::DBRowGenerator(
38  const std::vector< DBTranslatedValueType, ALLOC< DBTranslatedValueType > > column_types,
39  const DBRowGeneratorGoal goal,
40  const typename DBRowGenerator< ALLOC >::allocator_type& alloc) :
41  column_types_(column_types, alloc),
42  columns_of_interest_(alloc), goal_(goal) {
43  GUM_CONSTRUCTOR(DBRowGenerator);
44  }
45 
46 
47  /// copy constructor with a given allocator
48  template < template < typename > class ALLOC >
50  const DBRowGenerator< ALLOC >& from,
51  const typename DBRowGenerator< ALLOC >::allocator_type& alloc) :
56  }
57 
58 
59  /// copy constructor
60  template < template < typename > class ALLOC >
63 
64 
65  /// move constructor with a given allocator
66  template < template < typename > class ALLOC >
69  const typename DBRowGenerator< ALLOC >::allocator_type& alloc) :
74  }
75 
76 
77  /// move constructor
78  template < template < typename > class ALLOC >
81 
82 
83  /// destructor
84  template < template < typename > class ALLOC >
87  }
88 
89 
90  /// copy operator
91  template < template < typename > class ALLOC >
97  goal_ = from.goal_;
98  return *this;
99  }
100 
101 
102  /// move operator
103  template < template < typename > class ALLOC >
109  goal_ = from.goal_;
110  return *this;
111  }
112 
113 
114  /// returns true if there are still rows that can be output by the RowFilter
115  template < template < typename > class ALLOC >
116  INLINE bool DBRowGenerator< ALLOC >::hasRows() {
117  return nb_remaining_output_rows_ != std::size_t(0);
118  }
119 
120 
121  /// sets the input row from which the generator will create new rows
122  template < template < typename > class ALLOC >
125  return hasRows();
126  }
127 
128 
129  /// decrease the number of remaining output rows
130  template < template < typename > class ALLOC >
133  }
134 
135 
136  /// resets the filter
137  template < template < typename > class ALLOC >
138  INLINE void DBRowGenerator< ALLOC >::reset() {
140  }
141 
142 
143  // sets the columns of interest: the output DBRow needs only
144  // contain values fot these columns
145  template < template < typename > class ALLOC >
147  const std::vector< std::size_t, ALLOC< std::size_t > >& cols_of_interest) {
149  }
150 
151 
152  // sets the columns of interest: the output DBRow needs only
153  // contain values fot these columns
154  template < template < typename > class ALLOC >
158  }
159 
160 
161  /// returns the current set of columns of interest
162  template < template < typename > class ALLOC >
163  INLINE const std::vector< std::size_t, ALLOC< std::size_t > >&
165  return columns_of_interest_;
166  }
167 
168 
169  /// returns the allocator used
170  template < template < typename > class ALLOC >
173  }
174 
175 
176  /// returns the goal of the DBRowGenerator
177  template < template < typename > class ALLOC >
179  return goal_;
180  }
181 
182 
183  } /* namespace learning */
184 
185 } /* namespace gum */
186 
187 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
INLINE void emplace(Args &&... args)
Definition: set_tpl.h:643
Database(const std::string &filename, const BayesNet< GUM_SCALAR > &bn, const std::vector< std::string > &missing_symbols)