aGrUM  0.16.0
multiDimPartialInstantiation_tpl.h
Go to the documentation of this file.
1 
29 #include <agrum/agrum.h>
30 #include <typeinfo>
31 
32 #ifndef DOXYGEN_SHOULD_SKIP_THIS
33 
34 namespace gum {
35 
36  // constructor
37  template < typename GUM_SCALAR, template < typename > class TABLE >
38  MultiDimPartialInstantiation< GUM_SCALAR,
39  TABLE >::MultiDimPartialInstantiation() {
40  // for debugging purposes
41  GUM_CONSTRUCTOR(MultiDimPartialInstantiation);
42  }
43 
44  // copy constructor
45  template < typename GUM_SCALAR, template < typename > class TABLE >
47  const MultiDimPartialInstantiation< GUM_SCALAR, TABLE >& from) {
48  // for debugging purposes
49  GUM_CONS_CPY(MultiDimPartialInstantiation);
50  }
51 
52  // destructor
53  template < typename GUM_SCALAR, template < typename > class TABLE >
54  MultiDimPartialInstantiation< GUM_SCALAR,
55  TABLE >::~MultiDimPartialInstantiation() {
56  // for debugging purposes
57  GUM_DESTRUCTOR(MultiDimPartialInstantiation);
58  }
59 
60  // virtual constructor
61  template < typename GUM_SCALAR, template < typename > class TABLE >
62  MultiDimPartialInstantiation< GUM_SCALAR, TABLE >*
64  return new MultiDimPartialInstantiation< GUM_SCALAR, TABLE >(*this);
65  }
66 
67  // copy operator
68  template < typename GUM_SCALAR, template < typename > class TABLE >
69  MultiDimPartialInstantiation< GUM_SCALAR, TABLE >&
71  operator=(const MultiDimPartialInstantiation< GUM_SCALAR, TABLE >& from) {
72  return *this;
73  }
74 
75  // creates and returns the partial instantiation of the table
76  template < typename GUM_SCALAR, template < typename > class TABLE >
77  TABLE< GUM_SCALAR >*
79  const TABLE< GUM_SCALAR >& table,
80  const HashTable< const DiscreteVariable*, Idx >& inst_vars) {
81  MultiDimImplementation< GUM_SCALAR >* new_impl =
82  partialInstantiation(table, inst_vars);
83  return new TABLE< GUM_SCALAR >(new_impl);
84  }
85 
86  // creates and returns the partial instantiation of the table
87  template < typename GUM_SCALAR, template < typename > class TABLE >
89  TABLE< GUM_SCALAR >& container,
90  const TABLE< GUM_SCALAR >& table,
91  const HashTable< const DiscreteVariable*, Idx >& inst_vars) {
92  MultiDimImplementation< GUM_SCALAR >* new_impl =
93  partialInstantiation(table, inst_vars);
94  container = *new_impl;
95  delete new_impl;
96  }
97 
98 } /* namespace gum */
99 
100 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
MultiDimPartialInstantiation()
Default constructor.
MultiDimPartialInstantiation< GUM_SCALAR, TABLE > & operator=(const MultiDimPartialInstantiation< GUM_SCALAR, TABLE > &src)
Copy operator.
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
Definition: agrum.h:25
TABLE< GUM_SCALAR > * instantiate(const TABLE< GUM_SCALAR > &table, const HashTable< const DiscreteVariable *, Idx > &inst_vars)
Creates and returns the partial instantiation of the table over a subset of its variables.
MultiDimImplementation< GUM_SCALAR > * partialInstantiation(const MultiDimImplementation< GUM_SCALAR > &table, const HashTable< const DiscreteVariable *, Idx > &inst_vars)
Instantiate variables in a MultiDimImplementation.
virtual MultiDimPartialInstantiation< GUM_SCALAR, TABLE > * newFactory() const