aGrUM  0.20.3
a C++ library for (probabilistic) graphical models
DBRowGeneratorIdentity_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 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 >
48  const typename DBRowGeneratorIdentity< ALLOC >::allocator_type& alloc) :
51  alloc) {
53  }
54 
55 
56  /// copy constructor with a given allocator
57  template < template < typename > class ALLOC >
60  const typename DBRowGeneratorIdentity< ALLOC >::allocator_type& alloc) :
64  }
65 
66 
67  /// copy constructor
68  template < template < typename > class ALLOC >
70  const DBRowGeneratorIdentity< ALLOC >& from) :
72 
73 
74  /// move constructor with a given allocator
75  template < template < typename > class ALLOC >
78  const typename DBRowGeneratorIdentity< ALLOC >::allocator_type& alloc) :
82  }
83 
84 
85  /// move constructor
86  template < template < typename > class ALLOC >
90 
91 
92  /// virtual copy constructor with a given allocator
93  template < template < typename > class ALLOC >
95  const typename DBRowGeneratorIdentity< ALLOC >::allocator_type& alloc) const {
98  try {
100  } catch (...) {
102  throw;
103  }
104  return generator;
105  }
106 
107 
108  /// virtual copy constructor
109  template < template < typename > class ALLOC >
111  return clone(this->getAllocator());
112  }
113 
114 
115  /// destructor
116  template < template < typename > class ALLOC >
119  }
120 
121 
122  /// copy operator
123  template < template < typename > class ALLOC >
128  return *this;
129  }
130 
131 
132  /// move operator
133  template < template < typename > class ALLOC >
138  return *this;
139  }
140 
141 
142  /// generates new lines from those the generator gets in input
143  template < template < typename > class ALLOC >
145  this->decreaseRemainingRows();
146  return *_input_row_;
147  }
148 
149 
150  /// computes the rows it will provide in output
151  template < template < typename > class ALLOC >
152  INLINE std::size_t
154  _input_row_ = &row;
155  return std::size_t(1);
156  }
157 
158 
159  } /* namespace learning */
160 
161 } /* namespace gum */
162 
163 #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)