aGrUM
3.2.0
a C++ library for (probabilistic) graphical models
Toggle main menu visibility
DBRow.h
Go to the documentation of this file.
1
/****************************************************************************
2
* This file is part of the aGrUM/pyAgrum library. *
3
* *
4
* Copyright (c) 2005-2026 by *
5
* - Pierre-Henri WUILLEMIN(_at_LIP6) *
6
* - Christophe GONZALES(_at_AMU) *
7
* *
8
* The aGrUM/pyAgrum library is free software; you can redistribute it *
9
* and/or modify it under the terms of either : *
10
* *
11
* - the GNU Lesser General Public License as published by *
12
* the Free Software Foundation, either version 3 of the License, *
13
* or (at your option) any later version, *
14
* - the MIT license (MIT), *
15
* - or both in dual license, as here. *
16
* *
17
* (see https://agrum.gitlab.io/articles/dual-licenses-lgplv3mit.html) *
18
* *
19
* This aGrUM/pyAgrum library is distributed in the hope that it will be *
20
* useful, but WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, *
21
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES MERCHANTABILITY or FITNESS *
22
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE *
23
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *
24
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, *
25
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR *
26
* OTHER DEALINGS IN THE SOFTWARE. *
27
* *
28
* See LICENCES for more details. *
29
* *
30
* SPDX-FileCopyrightText: Copyright 2005-2026 *
31
* - Pierre-Henri WUILLEMIN(_at_LIP6) *
32
* - Christophe GONZALES(_at_AMU) *
33
* SPDX-License-Identifier: LGPL-3.0-or-later OR MIT *
34
* *
35
* Contact : info_at_agrum_dot_org *
36
* homepage : http://agrum.gitlab.io *
37
* gitlab : https://gitlab.com/agrumery/agrum *
38
* *
39
****************************************************************************/
40
41
47
#ifndef GUM_LEARNING_DB_ROW_H
48
#define GUM_LEARNING_DB_ROW_H
49
50
#include <cstddef>
51
#include <cstring>
52
#include <memory>
53
#include <vector>
54
55
#include <
agrum/agrum.h
>
56
57
#include <initializer_list>
58
59
namespace
gum
{
60
61
namespace
learning
{
62
74
template
<
typename
T_DATA >
75
class
DBRow
{
76
public
:
77
// ##########################################################################
79
// ##########################################################################
80
82
84
DBRow
();
85
87
DBRow
(
const
std::size_t
size
,
const
double
weight
= 1.0);
88
90
DBRow
(
const
std::size_t
size
,
const
T_DATA default_value,
const
double
weight
);
91
93
DBRow
(std::initializer_list< T_DATA > list,
const
double
weight
= 1.0);
94
96
DBRow
(
const
std::vector< T_DATA >& cells,
const
double
weight
= 1.0);
97
99
DBRow
(std::vector< T_DATA >&& cells,
const
double
weight
= 1.0);
100
102
DBRow
(
const
DBRow< T_DATA >
& from);
103
105
DBRow
(
DBRow< T_DATA >
&& from);
106
108
[[nodiscard]]
DBRow< T_DATA >
*
clone
()
const
;
109
111
~DBRow
();
112
114
115
116
// ##########################################################################
118
// ##########################################################################
119
121
123
DBRow< T_DATA >
&
operator=
(
const
DBRow< T_DATA >
& from);
124
126
DBRow< T_DATA >
&
operator=
(
DBRow< T_DATA >
&& from);
127
129
132
T_DATA&
operator[]
(
const
std::size_t i);
133
135
138
const
T_DATA&
operator[]
(
const
std::size_t i)
const
;
139
141
142
143
// ##########################################################################
145
// ##########################################################################
146
148
150
const
std::vector< T_DATA >&
row
() const noexcept;
151
153
std
::vector< T_DATA >&
row
() noexcept;
154
156
const
double
&
weight
() const noexcept;
157
159
double
&
weight
() noexcept;
160
162
void
setRow
(const
std
::vector< T_DATA >& new_row);
163
165
void
setRow
(
std
::vector< T_DATA >&& new_row);
166
168
void
setWeight
(const
double
new_weight);
169
171
std
::
size_t
size
() const noexcept;
172
174
void
resize
(const
std
::
size_t
new_size);
175
177
void
reserve
(const
std
::
size_t
new_size);
178
180
void
pushBack
(const T_DATA& elt);
181
183
void
pushBack
(T_DATA&& elt);
184
186
187
188
protected:
190
std
::vector< T_DATA >
row_
;
191
193
double
weight_
{1.0f};
194
};
195
196
}
/* namespace learning */
197
198
}
/* namespace gum */
199
201
#include <
agrum/base/database/DBRow_tpl.h
>
202
203
#endif
/* GUM_LEARNING_DB_ROW_H */
DBRow_tpl.h
The class representing a record stored in a tabular database.
agrum.h
gum::learning::DBRow< TX_DATA >::DBRow
DBRow(std::initializer_list< TX_DATA > list, const double weight=1.0)
gum::learning::DBRow< TX_DATA >::DBRow
DBRow(const DBRow< TX_DATA > &from)
gum::learning::DBRow< TX_DATA >::~DBRow
~DBRow()
gum::learning::DBRow< TX_DATA >< DBTranslatedValue >::row_
std::vector< TX_DATA > row_
Definition
DBRow.h:190
gum::learning::DBRow< TX_DATA >< DBTranslatedValue >::setRow
void setRow(const std::vector< TX_DATA > &new_row)
gum::learning::DBRow< TX_DATA >< DBTranslatedValue >::pushBack
void pushBack(const TX_DATA &elt)
gum::learning::DBRow< TX_DATA >::DBRow
DBRow(const std::size_t size, const TX_DATA default_value, const double weight)
gum::learning::DBRow< TX_DATA >::clone
DBRow< TX_DATA > * clone() const
gum::learning::DBRow< TX_DATA >::operator[]
const TX_DATA & operator[](const std::size_t i) const
gum::learning::DBRow< TX_DATA >::DBRow
DBRow(DBRow< TX_DATA > &&from)
gum::learning::DBRow< TX_DATA >::operator[]
TX_DATA & operator[](const std::size_t i)
gum::learning::DBRow::DBRow
DBRow()
default constructor
gum::learning::DBRow< TX_DATA >< DBTranslatedValue >::weight_
double weight_
Definition
DBRow.h:193
gum::learning::DBRow< TX_DATA >::DBRow
DBRow(const std::size_t size, const double weight=1.0)
gum::learning::DBRow< TX_DATA >::DBRow
DBRow(std::vector< TX_DATA > &&cells, const double weight=1.0)
gum::learning::DBRow< TX_DATA >::DBRow
DBRow(const std::vector< TX_DATA > &cells, const double weight=1.0)
gum::learning::DBRow< TX_DATA >< DBTranslatedValue >::weight
const double & weight() const noexcept
gum::learning::DBRow< TX_DATA >< DBTranslatedValue >::size
std::size_t size() const noexcept
gum::learning::DBRow< TX_DATA >< DBTranslatedValue >::setWeight
void setWeight(const double new_weight)
gum::learning::DBRow< TX_DATA >::row
const std::vector< TX_DATA > & row() const noexcept
gum::learning::DBRow< TX_DATA >::operator=
DBRow< TX_DATA > & operator=(DBRow< TX_DATA > &&from)
gum::learning::DBRow< TX_DATA >< DBTranslatedValue >::reserve
void reserve(const std::size_t new_size)
gum::learning::DBRow< TX_DATA >::operator=
DBRow< TX_DATA > & operator=(const DBRow< TX_DATA > &from)
gum::learning::DBRow< TX_DATA >< DBTranslatedValue >::resize
void resize(const std::size_t new_size)
gum::learning
include the inlined functions if necessary
Definition
CSVParser.h:55
gum
gum is the global namespace for all aGrUM entities
Definition
agrum.h:46
std
STL namespace.
aGrUM
3.2.0
© PHW&CG&others - 2022
DoXyGeN 1.18.0