aGrUM  0.14.2
completeProjectionRegister4MultiDim.h
Go to the documentation of this file.
1 /***************************************************************************
2  * Copyright (C) 2005 by Pierre-Henri WUILLEMIN et Christophe GONZALES *
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  ***************************************************************************/
28 #ifndef GUM_COMPLETE_PROJECTION_REGISTER_4_MULTI_DIM_H
29 #define GUM_COMPLETE_PROJECTION_REGISTER_4_MULTI_DIM_H
30 
31 #include <iostream>
32 #include <string>
33 #include <utility>
34 
35 #include <agrum/core/hashTable.h>
36 #include <agrum/core/set.h>
39 
40 namespace gum {
41 
42  // the base object used by the projections
43  template < typename GUM_SCALAR >
44  class MultiDimImplementation;
45 
46  // ===========================================================================
47  // === GUM_MULTI_DIM_COMPLETE_PROJECTION_REGISTER ===
48  // ===========================================================================
49 
50  // clang-format off
61  // clang-format on
62  template < typename GUM_SCALAR >
64  public:
66  typedef GUM_SCALAR (*CompleteProjectionPtr)(
68 
69  // =========================================================================
71  // =========================================================================
73 
96  void insert(const std::string& projection_name,
97  const std::string& type_multidim,
98  CompleteProjectionPtr newFunction);
99 
114  void erase(const std::string& projection_name,
115  const std::string& type_multidim);
116 
131  bool exists(const std::string& projection_name,
132  const std::string& type_multidim) const;
133 
150  CompleteProjectionPtr get(const std::string& projection_name,
151  const std::string& type_multidim) const;
152 
154 
155  // =========================================================================
157  // =========================================================================
159 
167 
169 
170  private:
171  // =========================================================================
173  // =========================================================================
175 
178 
182 
185 
187 
190 
201  };
202 
205  template < typename GUM_SCALAR >
206  void registerCompleteProjection(const std::string& projection_name,
207  const std::string& type_multidim,
209  GUM_SCALAR >::CompleteProjectionPtr function);
210 
211 } /* namespace gum */
212 
213 // always include the implementations
215 
216 #endif /* GUM_COMPLETE_PROJECTION_REGISTER_MULTI_DIM_H */
Base class for discrete random variable.
static CompleteProjectionRegister4MultiDim & Register()
A named constructor that constructs one and only one Register per data type.
Sets of elements (i.e.
void erase(const std::string &projection_name, const std::string &type_multidim)
Removes a given entry from the register.
bool exists(const std::string &projection_name, const std::string &type_multidim) const
Indicates whether a given entry exists in the register.
HashTable< std::string, CompleteProjectionPtr > CompleteProjectionSet
The set of associations for a given projection type.
gum is the global namespace for all aGrUM entities
Definition: agrum.h:25
The class for generic Hash Tables.
Definition: hashTable.h:676
void registerCompleteProjection(const std::string &projection_name, const std::string &type_multidim, typename CompleteProjectionRegister4MultiDim< GUM_SCALAR >::CompleteProjectionPtr function)
A function to more easily register new projection functions in MultiDims.
void insert(const std::string &projection_name, const std::string &type_multidim, CompleteProjectionPtr newFunction)
Adds a new entry into the register.
GUM_SCALAR(* CompleteProjectionPtr)(const MultiDimImplementation< GUM_SCALAR > *, Instantiation *instantiation)
the type of functions used by the register
HashTable< std::string, CompleteProjectionSet *> __set
A mapping from the types of MultiDimImplementations to projection operators.
CompleteProjectionRegister4MultiDim()
Default constructor: creates an empty register.
Header files of gum::Instantiation.
A container for registering complete projection functions on multiDimImplementations, i.e., projections over all variables.
Class for assigning/browsing values to tuples of discrete variables.
Definition: instantiation.h:80
<agrum/multidim/multiDimImplementation.h>
A container for registering complete projection functions on multiDimImplementations, i.e., functions projecting tables over all their variables.
Class hash tables iterators.