aGrUM  0.20.2
a C++ library for (probabilistic) graphical models
DBRowGenerator_tpl.h
Go to the documentation of this file.
1 /**
2  *
3  * Copyright 2005-2020 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 > >
39  column_types,
40  const DBRowGeneratorGoal goal,
41  const typename DBRowGenerator< ALLOC >::allocator_type& alloc) :
42  column_types_(column_types, alloc),
43  columns_of_interest_(alloc), goal_(goal) {
44  GUM_CONSTRUCTOR(DBRowGenerator);
45  }
46 
47 
48  /// copy constructor with a given allocator
49  template < template < typename > class ALLOC >
51  const DBRowGenerator< ALLOC >& from,
52  const typename DBRowGenerator< ALLOC >::allocator_type& alloc) :
57  }
58 
59 
60  /// copy constructor
61  template < template < typename > class ALLOC >
63  const DBRowGenerator< ALLOC >& from) :
65 
66 
67  /// move constructor with a given allocator
68  template < template < typename > class ALLOC >
71  const typename DBRowGenerator< ALLOC >::allocator_type& alloc) :
75  goal_(from.goal_) {
77  }
78 
79 
80  /// move constructor
81  template < template < typename > class ALLOC >
82  INLINE
85 
86 
87  /// destructor
88  template < template < typename > class ALLOC >
91  }
92 
93 
94  /// copy operator
95  template < template < typename > class ALLOC >
101  goal_ = from.goal_;
102  return *this;
103  }
104 
105 
106  /// move operator
107  template < template < typename > class ALLOC >
113  goal_ = from.goal_;
114  return *this;
115  }
116 
117 
118  /// returns true if there are still rows that can be output by the RowFilter
119  template < template < typename > class ALLOC >
120  INLINE bool DBRowGenerator< ALLOC >::hasRows() {
121  return nb_remaining_output_rows_ != std::size_t(0);
122  }
123 
124 
125  /// sets the input row from which the generator will create new rows
126  template < template < typename > class ALLOC >
128  const DBRow< DBTranslatedValue, ALLOC >& row) {
130  return hasRows();
131  }
132 
133 
134  /// decrease the number of remaining output rows
135  template < template < typename > class ALLOC >
138  }
139 
140 
141  /// resets the filter
142  template < template < typename > class ALLOC >
143  INLINE void DBRowGenerator< ALLOC >::reset() {
145  }
146 
147 
148  // sets the columns of interest: the output DBRow needs only
149  // contain values fot these columns
150  template < template < typename > class ALLOC >
152  const std::vector< std::size_t, ALLOC< std::size_t > >& cols_of_interest) {
154  }
155 
156 
157  // sets the columns of interest: the output DBRow needs only
158  // contain values fot these columns
159  template < template < typename > class ALLOC >
163  }
164 
165 
166  /// returns the current set of columns of interest
167  template < template < typename > class ALLOC >
168  INLINE const std::vector< std::size_t, ALLOC< std::size_t > >&
170  return columns_of_interest_;
171  }
172 
173 
174  /// returns the allocator used
175  template < template < typename > class ALLOC >
176  typename DBRowGenerator< ALLOC >::allocator_type
177  DBRowGenerator< ALLOC >::getAllocator() const {
179  }
180 
181 
182  /// returns the goal of the DBRowGenerator
183  template < template < typename > class ALLOC >
185  return goal_;
186  }
187 
188 
189  } /* namespace learning */
190 
191 } /* namespace gum */
192 
193 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
INLINE void emplace(Args &&... args)
Definition: set_tpl.h:669
Database(const std::string &filename, const BayesNet< GUM_SCALAR > &bn, const std::vector< std::string > &missing_symbols)