aGrUM  0.14.2
projectionPattern4MultiDimImplementation.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 // check if we allowed these patterns to be used
29 #ifndef GUM_PROJECTION_PATTERN_ALLOWED
30 
31 // #warning To use projectionPattern4MultiDimImplementation.h, you must define
32 // GUM_PROJECTION_PATTERN_ALLOWED
33 
34 #else
35 
36 namespace gum {
37 
38 # ifdef GUM_MULTI_DIM_PROJECTION_NAME
39  template < typename GUM_SCALAR >
40  MultiDimImplementation< GUM_SCALAR >* GUM_MULTI_DIM_PROJECTION_NAME(
41  const MultiDimImplementation< GUM_SCALAR >& ttable,
42  const Set< const DiscreteVariable* >& del_vars) {
43 # endif
44 
46 
47  // get the appropriate function to perform the operation
48  try {
49  // try to find func(ttable,del_vars) in the register
51  GUM_MULTI_DIM_PROJECTION_FUNC_NAME, ttable.name());
52  } catch (NotFound&) {
54  GUM_MULTI_DIM_PROJECTION_FUNC_NAME, ttable.basename());
55  }
56 
57  // perform the projection
58  return func(&ttable, del_vars);
59  }
60 } // namespace gum
61 #endif /* GUM_PROJECTION_PATTERN_ALLOWED */
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
gum is the global namespace for all aGrUM entities
Definition: agrum.h:25
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 ...