aGrUM  0.20.2
a C++ library for (probabilistic) graphical models
DBRowGeneratorIdentity_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 A filtered row generator that returns exactly the rows it gets in
24  *input
25  *
26  * @author Christophe GONZALES(@AMU) and Pierre-Henri WUILLEMIN(@LIP6)
27  */
28 #include <agrum/tools/database/DBRowGeneratorIdentity.h>
29 
30 #ifndef DOXYGEN_SHOULD_SKIP_THIS
31 
32 namespace gum {
33 
34  namespace learning {
35 
36  /// returns the allocator used
37  template < template < typename > class ALLOC >
40  return DBRowGenerator< ALLOC >::getAllocator();
41  }
42 
43 
44  /// default constructor
45  template < template < typename > class ALLOC >
49  const typename DBRowGeneratorIdentity< ALLOC >::allocator_type& alloc) :
53  alloc) {
55  }
56 
57 
58  /// copy constructor with a given allocator
59  template < template < typename > class ALLOC >
62  const typename DBRowGeneratorIdentity< ALLOC >::allocator_type& alloc) :
66  }
67 
68 
69  /// copy constructor
70  template < template < typename > class ALLOC >
72  const DBRowGeneratorIdentity< ALLOC >& from) :
74 
75 
76  /// move constructor with a given allocator
77  template < template < typename > class ALLOC >
80  const typename DBRowGeneratorIdentity< ALLOC >::allocator_type& alloc) :
84  }
85 
86 
87  /// move constructor
88  template < template < typename > class ALLOC >
92 
93 
94  /// virtual copy constructor with a given allocator
95  template < template < typename > class ALLOC >
98  const {
101  try {
103  } catch (...) {
105  throw;
106  }
107  return generator;
108  }
109 
110 
111  /// virtual copy constructor
112  template < template < typename > class ALLOC >
114  DBRowGeneratorIdentity< ALLOC >::clone() const {
115  return clone(this->getAllocator());
116  }
117 
118 
119  /// destructor
120  template < template < typename > class ALLOC >
123  }
124 
125 
126  /// copy operator
127  template < template < typename > class ALLOC >
129  const DBRowGeneratorIdentity< ALLOC >& from) {
132  return *this;
133  }
134 
135 
136  /// move operator
137  template < template < typename > class ALLOC >
142  return *this;
143  }
144 
145 
146  /// generates new lines from those the generator gets in input
147  template < template < typename > class ALLOC >
150  this->decreaseRemainingRows();
151  return *input_row__;
152  }
153 
154 
155  /// computes the rows it will provide in output
156  template < template < typename > class ALLOC >
158  const DBRow< DBTranslatedValue, ALLOC >& row) {
159  input_row__ = &row;
160  return std::size_t(1);
161  }
162 
163 
164  } /* namespace learning */
165 
166 } /* namespace gum */
167 
168 #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)