aGrUM  0.14.2
partialInstantiationRegister4MultiDim.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  ***************************************************************************/
27 #ifndef GUM_PARTIAL_INSTANTIATION_REGISTER_4_MULTI_DIM_H
28 #define GUM_PARTIAL_INSTANTIATION_REGISTER_4_MULTI_DIM_H
29 
30 #include <agrum/core/hashTable.h>
31 #include <agrum/core/set.h>
33 #include <iostream>
34 #include <string>
35 #include <utility>
36 
37 namespace gum {
38 
39  // the base object used by the partial instantiations
40  template < typename GUM_SCALAR >
41  class MultiDimImplementation;
42 
43  // ==========================================================================
44  // === GUM_MULTI_DIM_PARTIAL_INSTANTIATION_REGISTER ===
45  // ==========================================================================
64  template < typename GUM_SCALAR >
66  public:
68  typedef MultiDimImplementation< GUM_SCALAR >* (*PartialInstantiationPtr)(
71 
72  // ========================================================================
74  // ========================================================================
76 
78 
99  void insert(const std::string& instantiation_func_name,
100  const std::string& type_multidim,
101  PartialInstantiationPtr newFunction);
102 
115  void erase(const std::string& instantiation_func_name,
116  const std::string& type_multidim);
117 
131  bool exists(const std::string& instantiation_func_name,
132  const std::string& type_multidim) const;
133 
150  PartialInstantiationPtr get(const std::string& instantiation_func_name,
151  const std::string& type_multidim) const;
152 
154  // =========================================================================
156  // =========================================================================
158 
166 
168 
169  private:
170  // =========================================================================
172  // =========================================================================
174 
179 
185 
190 
192 
196 
207  };
208 
211  template < typename GUM_SCALAR >
213  const std::string& instantiation_func_name,
214  const std::string& type_multidim,
216  GUM_SCALAR >::PartialInstantiationPtr function);
217 
218 } /* namespace gum */
219 
220 // always include the implementations
222 
223 #endif /* GUM_PARTIAL_INSTANTIATION_REGISTER_MULTI_DIM_H */
~PartialInstantiationRegister4MultiDim()
Class destructor.
static PartialInstantiationRegister4MultiDim & Register()
A named constructor that constructs one and only one Register per data type.
Base class for discrete random variable.
Sets of elements (i.e.
MultiDimImplementation< GUM_SCALAR > *(* PartialInstantiationPtr)(const MultiDimImplementation< GUM_SCALAR > *, const HashTable< const DiscreteVariable *, Idx > &)
The type of functions used by the register.
HashTable< std::string, PartialInstantiationSet *> __set
A mapping from the types of MultiDimImplementations to partial instantiation operators.
void erase(const std::string &instantiation_func_name, const std::string &type_multidim)
Removes a given entry from the register.
bool exists(const std::string &instantiation_func_name, const std::string &type_multidim) const
Indicates whether a given entry exists in the register.
PartialInstantiationRegister4MultiDim()
Default constructor: creates an empty register.
gum is the global namespace for all aGrUM entities
Definition: agrum.h:25
The class for generic Hash Tables.
Definition: hashTable.h:676
A container for registering partial instantiation functions on multiDimImplementations, i.e., functions assigning values to subsets of the variables of some tables.
void registerPartialInstantiation(const std::string &instantiation_func_name, const std::string &type_multidim, typename PartialInstantiationRegister4MultiDim< GUM_SCALAR >::PartialInstantiationPtr function)
A function to more easily register new instantiation functions in MultiDims.
void insert(const std::string &instantiation_func_name, const std::string &type_multidim, PartialInstantiationPtr newFunction)
Adds a new entry into the register.
<agrum/multidim/multiDimImplementation.h>
Implementation of PartialInstantiationRegister4MultiDim.
Class hash tables iterators.
HashTable< std::string, PartialInstantiationPtr > PartialInstantiationSet
The set of associations for a given partial instantiation type.