aGrUM  0.14.2
projectionRegister4MultiDim.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_PROJECTION_REGISTER_4_MULTI_DIM_H
29 #define GUM_PROJECTION_REGISTER_4_MULTI_DIM_H
30 
31 #include <agrum/core/hashTable.h>
32 #include <agrum/core/set.h>
34 #include <iostream>
35 #include <string>
36 #include <utility>
37 
38 namespace gum {
39 
40  // the base object used by the projections
41  template < typename GUM_SCALAR >
42  class MultiDimImplementation;
43 
44  // ===========================================================================
45  // === GUM_MULTI_DIM_PROJECTION_REGISTER ===
46  // ===========================================================================
47  // clang-format off
57  // clang-format on
58  template < typename GUM_SCALAR >
60  public:
62  typedef MultiDimImplementation< GUM_SCALAR >* (*ProjectionPtr)(
65 
66  // ========================================================================
68  // ========================================================================
70 
94  void insert(const std::string& projection_name,
95  const std::string& type_multidim,
96  ProjectionPtr newFunction);
97 
112  void erase(const std::string& projection_name,
113  const std::string& type_multidim);
114 
129  bool exists(const std::string& projection_name,
130  const std::string& type_multidim) const;
131 
150  ProjectionPtr get(const std::string& projection_name,
151  const std::string& type_multidim) const;
152 
154  // ========================================================================
156  // ========================================================================
158 
166 
168 
169  private:
170  // ========================================================================
172  // ========================================================================
174 
177 
180 
183 
185 
188 
199  };
200 
202  template < typename GUM_SCALAR >
203  void registerProjection(
204  const std::string& projection_name,
205  const std::string& type_multidim,
207 
208  // a display operator for ProjectionPtrs
209 
210 } /* namespace gum */
211 
212 // always include the implementations
214 
215 #endif /* GUM_PROJECTION_REGISTER_MULTI_DIM_H */
static ProjectionRegister4MultiDim & Register()
a named constructor that constructs one and only one Register per data type
MultiDimImplementation< GUM_SCALAR > *(* ProjectionPtr)(const MultiDimImplementation< GUM_SCALAR > *, const Set< const DiscreteVariable * > &)
the type of functions used by the register
Base class for discrete random variable.
Sets of elements (i.e.
HashTable< std::string, ProjectionPtr > ProjectionSet
The set of associations for a given projection type.
void erase(const std::string &projection_name, const std::string &type_multidim)
removes a given entry from the register
gum is the global namespace for all aGrUM entities
Definition: agrum.h:25
The class for generic Hash Tables.
Definition: hashTable.h:676
bool exists(const std::string &projection_name, const std::string &type_multidim) const
indicates whether a given entry exists in the register
Representation of a setA Set is a structure that contains arbitrary elements.
Definition: set.h:162
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.
HashTable< std::string, ProjectionSet *> __set
A mapping from the types of MultiDimImplementations to projection operators.
A container for registering projection functions on multiDimImplementations, i.e., functions projecting tables over a subset of their variables.
void insert(const std::string &projection_name, const std::string &type_multidim, ProjectionPtr newFunction)
adds a new entry into the register
A container for registering projection functions on multiDimImplementations.
~ProjectionRegister4MultiDim()
Destructor.
ProjectionRegister4MultiDim()
Default constructor: creates an empty register.
<agrum/multidim/multiDimImplementation.h>
Class hash tables iterators.