25 #ifndef DOXYGEN_SHOULD_SKIP_THIS 35 template <
typename T_DATA,
template <
typename >
class ALLOC >
37 return _row.get_allocator();
42 template <
typename T_DATA,
template <
typename >
class ALLOC >
45 GUM_CONSTRUCTOR(
DBRow);
50 template <
typename T_DATA,
template <
typename >
class ALLOC >
55 template <
typename T_DATA,
template <
typename >
class ALLOC >
57 const T_DATA default_cell,
59 const ALLOC< T_DATA >& alloc) :
60 _row(size, default_cell, alloc),
62 GUM_CONSTRUCTOR(
DBRow);
67 template <
typename T_DATA,
template <
typename >
class ALLOC >
70 const ALLOC< T_DATA >& alloc) :
71 DBRow(size, T_DATA(), weight, alloc) {}
74 template <
typename T_DATA,
template <
typename >
class ALLOC >
77 const ALLOC< T_DATA >& alloc) :
80 GUM_CONSTRUCTOR(
DBRow);
85 template <
typename T_DATA,
template <
typename >
class ALLOC >
86 template <
template <
typename >
class OTHER_ALLOC >
88 const std::vector< T_DATA, OTHER_ALLOC< T_DATA > >& new_row) {
89 const std::size_t
size = new_row.size();
92 std::copy(new_row.begin(), new_row.end(),
_row.begin());
100 template <
typename T_DATA,
template <
typename >
class ALLOC >
102 std::vector< T_DATA, ALLOC< T_DATA > >&& new_row) {
103 _row = std::move(new_row);
108 template <
typename T_DATA,
template <
typename >
class ALLOC >
109 template <
template <
typename >
class OTHER_ALLOC >
111 const std::vector< T_DATA, OTHER_ALLOC< T_DATA > >& cells,
113 const ALLOC< T_DATA >& alloc) :
117 GUM_CONSTRUCTOR(
DBRow);
122 template <
typename T_DATA,
template <
typename >
class ALLOC >
124 std::vector< T_DATA, ALLOC< T_DATA > >&& cells,
126 const ALLOC< T_DATA >& alloc) :
129 GUM_CONSTRUCTOR(
DBRow);
134 template <
typename T_DATA,
template <
typename >
class ALLOC >
136 const ALLOC< T_DATA >& alloc) :
144 template <
typename T_DATA,
template <
typename >
class ALLOC >
150 template <
typename T_DATA,
template <
typename >
class ALLOC >
152 const ALLOC< T_DATA >& alloc) :
160 template <
typename T_DATA,
template <
typename >
class ALLOC >
166 template <
typename T_DATA,
template <
typename >
class ALLOC >
167 DBRow< T_DATA, ALLOC >*
169 ALLOC< DBRow< T_DATA, ALLOC > > allocator(alloc);
170 DBRow< T_DATA, ALLOC >*
row = allocator.allocate(1);
172 allocator.construct(row, *
this, alloc);
174 allocator.deallocate(row, 1);
182 template <
typename T_DATA,
template <
typename >
class ALLOC >
189 template <
typename T_DATA,
template <
typename >
class ALLOC >
191 GUM_DESTRUCTOR(
DBRow);
196 template <
typename T_DATA,
template <
typename >
class ALLOC >
198 operator=(
const DBRow< T_DATA, ALLOC >& from) {
208 template <
typename T_DATA,
template <
typename >
class ALLOC >
210 operator=(DBRow< T_DATA, ALLOC >&& from) {
212 _row = std::move(from._row);
219 template <
typename T_DATA,
template <
typename >
class ALLOC >
225 template <
typename T_DATA,
template <
typename >
class ALLOC >
232 template <
typename T_DATA,
template <
typename >
class ALLOC >
233 INLINE
const std::vector< T_DATA, ALLOC< T_DATA > >&
239 template <
typename T_DATA,
template <
typename >
class ALLOC >
240 INLINE std::vector< T_DATA, ALLOC< T_DATA > >&
246 template <
typename T_DATA,
template <
typename >
class ALLOC >
252 template <
typename T_DATA,
template <
typename >
class ALLOC >
258 template <
typename T_DATA,
template <
typename >
class ALLOC >
264 template <
typename T_DATA,
template <
typename >
class ALLOC >
270 template <
typename T_DATA,
template <
typename >
class ALLOC >
272 _row.resize(new_size);
276 template <
typename T_DATA,
template <
typename >
class ALLOC >
278 _row.reserve(new_size);
282 template <
typename T_DATA,
template <
typename >
class ALLOC >
288 template <
typename T_DATA,
template <
typename >
class ALLOC >
290 _row.push_back(std::move(elt));
DBRow< T_DATA, ALLOC > * clone() const
virtual copy constructor
double _weight
the weight of the row
DBRow()
default constructor
DBRow< T_DATA, ALLOC > & operator=(const DBRow< T_DATA, ALLOC > &from)
copy operator
gum is the global namespace for all aGrUM entities
The class representing a record stored in a tabular database.
std::vector< T_DATA, ALLOC< T_DATA > > _row
the row itself
void setRow(const std::vector< T_DATA, OTHER_ALLOC< T_DATA > > &new_row)
sets a new row (without changing the weight)
void setWeight(const double new_weight)
sets a new weight
const std::vector< T_DATA, ALLOC< T_DATA > > & row() const noexcept
returns the current row (without the weight)
const double & weight() const noexcept
returns the weight assigned to the DBRow
void resize(const std::size_t new_size)
resize a given row, i.e., its number of elements
std::size_t size() const noexcept
returns the number of elements in the row
T_DATA & operator[](const std::size_t i)
returns the ith content of the row
void reserve(const std::size_t new_size)
reserve a size for the elements of a given row
ALLOC< T_DATA > getAllocator() const
returns the allocator used by the DBRow
void pushBack(const T_DATA &elt)
adds a new element at the end of the row