aGrUM 2.3.2
a C++ library for (probabilistic) graphical models
projectionRegister4MultiDim.h
Go to the documentation of this file.
1/****************************************************************************
2 * This file is part of the aGrUM/pyAgrum library. *
3 * *
4 * Copyright (c) 2005-2025 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-2025 *
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_PROJECTION_REGISTER_4_MULTI_DIM_H
51#define GUM_PROJECTION_REGISTER_4_MULTI_DIM_H
52
53#include <atomic>
54#include <iostream>
55#include <string>
56#include <utility>
57
59
60namespace gum {
61
62 // the base object used by the projections
63 template < typename GUM_SCALAR >
65
66 // ===========================================================================
67 // === GUM_MULTI_DIM_PROJECTION_REGISTER ===
68 // ===========================================================================
69 // clang-format off
79 // clang-format on
80
81 template < typename GUM_SCALAR >
83 public:
87 const gum::VariableSet&);
88
89 // ========================================================================
91 // ========================================================================
93
117 void insert(const std::string& projection_name,
118 const std::string& type_multidim,
119 ProjectionPtr newFunction);
120
135 void erase(const std::string& projection_name, const std::string& type_multidim);
136
151 bool exists(const std::string& projection_name, const std::string& type_multidim) const;
152
171 ProjectionPtr get(const std::string& projection_name, const std::string& type_multidim) const;
172
174 // ========================================================================
176 // ========================================================================
178
186
188
189 private:
190 // ========================================================================
192 // ========================================================================
194
197
200
203
205
208
219 };
220
222 template < typename GUM_SCALAR >
224 const std::string& projection_name,
225 const std::string& type_multidim,
227
228 // a display operator for ProjectionPtrs
229
230} /* namespace gum */
231
232// always include the implementations
234
235#endif /* GUM_PROJECTION_REGISTER_MULTI_DIM_H */
<agrum/base/multidim/multiDimImplementation.h>
void insert(const std::string &projection_name, const std::string &type_multidim, ProjectionPtr newFunction)
adds a new entry into the register
ProjectionRegister4MultiDim()
Default constructor: creates an empty register.
void erase(const std::string &projection_name, const std::string &type_multidim)
removes a given entry from the register
MultiDimImplementation< GUM_SCALAR > *(*)(const MultiDimImplementation< GUM_SCALAR > *, const gum::VariableSet &) ProjectionPtr
the type of functions used by the register
HashTable< std::string, ProjectionSet * > _set_
A mapping from the types of MultiDimImplementations to projection operators.
bool exists(const std::string &projection_name, const std::string &type_multidim) const
indicates whether a given entry exists in the register
ProjectionPtr get(const std::string &projection_name, const std::string &type_multidim) const
returns the specialized projection operator assigned to a given type of MultiDimImplementation
static ProjectionRegister4MultiDim & Register()
a named constructor that constructs one and only one Register per data type
HashTable< std::string, ProjectionPtr > ProjectionSet
The set of associations for a given projection type.
Base class for discrete random variable.
gum is the global namespace for all aGrUM entities
Definition agrum.h:46
Set< const DiscreteVariable * > VariableSet
void registerProjection(const std::string &projection_name, const std::string &type_multidim, typename ProjectionRegister4MultiDim< GUM_SCALAR >::ProjectionPtr function)
A function to more easily register new projection functions in MultiDims.
A container for registering projection functions on multiDimImplementations.