aGrUM  0.16.0
partialInstantiationPattern4MultiDimImplementation.h
Go to the documentation of this file.
1 
32 // check if we allowed these patterns to be used
33 #ifndef GUM_PARTIAL_INSTANTIATION_PATTERN_ALLOWED
34 
35 // #warning To use partialIntantiationPattern4MultiDimImplementation.h, you must
36 // define GUM_PARTIAL_INSTANTIATION_PATTERN_ALLOWED
37 
38 #else
39 namespace gum {
40 
41 # ifdef GUM_MULTI_DIM_PARTIAL_INSTANTIATION_NAME
42  template < typename GUM_SCALAR >
43  MultiDimImplementation< GUM_SCALAR >* GUM_MULTI_DIM_PARTIAL_INSTANTIATION_NAME(
44  const MultiDimImplementation< GUM_SCALAR >& ttable,
45  const HashTable< const DiscreteVariable*, Idx >& inst_vars) {
46 # endif
47 
48  typename PartialInstantiationRegister4MultiDim<
49  GUM_SCALAR >::PartialInstantiationPtr func;
50 
51  // get the appropriate function to perform the operation
52  try {
53  // try to find func(ttable,inst_vars) in the register
55  "i", ttable.name());
56  } catch (NotFound&) {
58  "i", ttable.basename());
59  }
60 
61  // perform the partial instantiation
62  return func(&ttable, inst_vars);
63  }
64 
65 } /* End of namespace gum */
66 
67 #endif /* GUM_PARTIAL_INSTANTIATION_PATTERN_ALLOWED */
static PartialInstantiationRegister4MultiDim & Register()
A named constructor that constructs one and only one Register per data type.
PartialInstantiationPtr get(const std::string &instantiation_func_name, const std::string &type_multidim) const
Returns the specialized partial instantiation operator assigned to a given type of MultiDimImplementa...
#define GUM_MULTI_DIM_PARTIAL_INSTANTIATION_NAME
a specialized partial instantiation function for multiDimArrays
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
Definition: agrum.h:25