aGrUM 3.1.1
a C++ library for (probabilistic) graphical models
completeProjectionRegister4MultiDim.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
49
50#ifndef GUM_COMPLETE_PROJECTION_REGISTER_4_MULTI_DIM_H
51#define GUM_COMPLETE_PROJECTION_REGISTER_4_MULTI_DIM_H
52
53#include <atomic>
54#include <iostream>
55#include <string>
56#include <utility>
57
59
60#include <string_view>
61
62namespace gum {
63
64 // the base object used by the projections
65 template < typename GUM_ELEMENT >
67
68 // ===========================================================================
69 // === GUM_MULTI_DIM_COMPLETE_PROJECTION_REGISTER ===
70 // ===========================================================================
71
72 // clang-format off
83 // clang-format on
84
85 template < typename GUM_ELEMENT >
87 public:
90 Instantiation* instantiation);
91
92 // =========================================================================
94 // =========================================================================
96
119 void insert(std::string_view projection_name,
120 std::string_view type_multidim,
121 CompleteProjectionPtr newFunction);
122
137 void erase(std::string_view projection_name, std::string_view type_multidim);
138
153 bool exists(std::string_view projection_name, std::string_view type_multidim) const;
154
171 CompleteProjectionPtr get(std::string_view projection_name,
172 std::string_view type_multidim) const;
173
175
176 // =========================================================================
178 // =========================================================================
180
188
190
191 private:
192 // =========================================================================
194 // =========================================================================
196
199
202
205
207
210
221 };
222
225 template < typename GUM_ELEMENT >
227 std::string_view projection_name,
228 std::string_view type_multidim,
230
231} /* namespace gum */
232
233// always include the implementations
235
236#endif /* GUM_COMPLETE_PROJECTION_REGISTER_MULTI_DIM_H */
void insert(std::string_view projection_name, std::string_view type_multidim, CompleteProjectionPtr newFunction)
Adds a new entry into the register.
static CompleteProjectionRegister4MultiDim & Register()
A named constructor that constructs one and only one Register per data type.
CompleteProjectionRegister4MultiDim(const CompleteProjectionRegister4MultiDim &)
copy operator: never to be used
CompleteProjectionRegister4MultiDim()
Default constructor: creates an empty register.
HashTable< std::string, CompleteProjectionPtr > CompleteProjectionSet
The set of associations for a given projection type.
bool exists(std::string_view projection_name, std::string_view type_multidim) const
Indicates whether a given entry exists in the register.
void erase(std::string_view projection_name, std::string_view type_multidim)
Removes a given entry from the register.
HashTable< std::string, CompleteProjectionSet * > _set_
A mapping from the types of MultiDimImplementations to projection operators.
GUM_ELEMENT(*)(const MultiDimImplementation< GUM_ELEMENT > *, Instantiation *instantiation) CompleteProjectionPtr
the type of functions used by the register
CompleteProjectionPtr get(std::string_view projection_name, std::string_view type_multidim) const
returns the specialized projection operator assigned to a given type of MultiDimImplementation
Class for assigning/browsing values to tuples of discrete variables.
<agrum/base/multidim/multiDimImplementation.h>
A container for registering complete projection functions on multiDimImplementations,...
void registerCompleteProjection(std::string_view projection_name, std::string_view type_multidim, typename CompleteProjectionRegister4MultiDim< GUM_ELEMENT >::CompleteProjectionPtr function)
A function to more easily register new projection functions in MultiDims.
Header files of gum::Instantiation.
gum is the global namespace for all aGrUM entities
Definition agrum.h:46