aGrUM  0.14.2
DBRowGeneratorIdentity_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  ***************************************************************************/
27 
28 #ifndef DOXYGEN_SHOULD_SKIP_THIS
29 
30 namespace gum {
31 
32  namespace learning {
33 
35  template < template < typename > class ALLOC >
39  }
40 
41 
43  template < template < typename > class ALLOC >
45  const std::vector< DBTranslatedValueType, ALLOC< DBTranslatedValueType > >
46  column_types,
48  DBRowGenerator< ALLOC >(
49  column_types,
51  alloc) {
52  GUM_CONSTRUCTOR(DBRowGeneratorIdentity);
53  }
54 
55 
57  template < template < typename > class ALLOC >
59  const DBRowGeneratorIdentity< ALLOC >& from,
61  DBRowGenerator< ALLOC >(from, alloc),
62  __input_row(from.__input_row) {
63  GUM_CONS_CPY(DBRowGeneratorIdentity);
64  }
65 
66 
68  template < template < typename > class ALLOC >
70  const DBRowGeneratorIdentity< ALLOC >& from) :
71  DBRowGeneratorIdentity< ALLOC >(from, from.getAllocator()) {}
72 
73 
75  template < template < typename > class ALLOC >
77  DBRowGeneratorIdentity< ALLOC >&& from,
79  DBRowGenerator< ALLOC >(std::move(from), alloc),
80  __input_row(from.__input_row) {
81  GUM_CONS_MOV(DBRowGeneratorIdentity);
82  }
83 
84 
86  template < template < typename > class ALLOC >
88  DBRowGeneratorIdentity< ALLOC >&& from) :
89  DBRowGeneratorIdentity< ALLOC >(std::move(from), from.getAllocator()) {}
90 
91 
93  template < template < typename > class ALLOC >
94  DBRowGeneratorIdentity< ALLOC >* DBRowGeneratorIdentity< ALLOC >::clone(
96  const {
97  ALLOC< DBRowGeneratorIdentity< ALLOC > > allocator(alloc);
98  DBRowGeneratorIdentity< ALLOC >* generator = allocator.allocate(1);
99  try {
100  allocator.construct(generator, *this, alloc);
101  } catch (...) {
102  allocator.deallocate(generator, 1);
103  throw;
104  }
105  return generator;
106  }
107 
108 
110  template < template < typename > class ALLOC >
111  DBRowGeneratorIdentity< ALLOC >*
113  return clone(this->getAllocator());
114  }
115 
116 
118  template < template < typename > class ALLOC >
120  GUM_DESTRUCTOR(DBRowGeneratorIdentity);
121  }
122 
123 
125  template < template < typename > class ALLOC >
126  DBRowGeneratorIdentity< ALLOC >& DBRowGeneratorIdentity< ALLOC >::
127  operator=(const DBRowGeneratorIdentity< ALLOC >& from) {
129  __input_row = from.__input_row;
130  return *this;
131  }
132 
133 
135  template < template < typename > class ALLOC >
136  DBRowGeneratorIdentity< ALLOC >& DBRowGeneratorIdentity< ALLOC >::
137  operator=(DBRowGeneratorIdentity< ALLOC >&& from) {
138  DBRowGenerator< ALLOC >::operator=(std::move(from));
139  __input_row = from.__input_row;
140  return *this;
141  }
142 
143 
145  template < template < typename > class ALLOC >
146  INLINE const DBRow< DBTranslatedValue, ALLOC >&
148  this->decreaseRemainingRows();
149  return *__input_row;
150  }
151 
152 
154  template < template < typename > class ALLOC >
156  const DBRow< DBTranslatedValue, ALLOC >& row) {
157  __input_row = &row;
158  return std::size_t(1);
159  }
160 
161 
162  } /* namespace learning */
163 
164 } /* namespace gum */
165 
166 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
DBRowGeneratorGoal
the type of things that a DBRowGenerator is designed for
DBRowGenerator< ALLOC > & operator=(const DBRowGenerator< ALLOC > &)
copy constructor
allocator_type getAllocator() const
returns the allocator used
DBRowGeneratorIdentity(const std::vector< DBTranslatedValueType, ALLOC< DBTranslatedValueType > > column_types, const allocator_type &alloc=allocator_type())
default constructor
void decreaseRemainingRows()
decrease the number of remaining output rows
virtual DBRowGeneratorIdentity< ALLOC > * clone() const override final
virtual copy constructor
STL namespace.
gum is the global namespace for all aGrUM entities
Definition: agrum.h:25
DBRowGeneratorIdentity< ALLOC > & operator=(const DBRowGeneratorIdentity< ALLOC > &from)
copy operator
virtual std::size_t _computeRows(const DBRow< DBTranslatedValue, ALLOC > &row) final
computes the rows it will provide as output
DBTranslatedValueType
The nature of the elements handled by translators (discrete, continuous).
allocator_type getAllocator() const
returns the allocator used
DBRowGenerator(const std::vector< DBTranslatedValueType, ALLOC< DBTranslatedValueType > > column_types, const DBRowGeneratorGoal goal, const allocator_type &alloc=allocator_type())
default constructor
virtual const DBRow< DBTranslatedValue, ALLOC > & generate() final
generates one ouput DBRow for each DBRow passed to method setInputRow
A DBRowGenerator class that returns exactly the rows it gets in input.
ALLOC< DBTranslatedValue > allocator_type
type for the allocators passed in arguments of methods