aGrUM  0.14.2
multiDimPartialInstantiation_tpl.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  ***************************************************************************/
26 #include <agrum/agrum.h>
27 #include <typeinfo>
28 
29 #ifndef DOXYGEN_SHOULD_SKIP_THIS
30 
31 namespace gum {
32 
33  // constructor
34  template < typename GUM_SCALAR, template < typename > class TABLE >
35  MultiDimPartialInstantiation< GUM_SCALAR,
36  TABLE >::MultiDimPartialInstantiation() {
37  // for debugging purposes
38  GUM_CONSTRUCTOR(MultiDimPartialInstantiation);
39  }
40 
41  // copy constructor
42  template < typename GUM_SCALAR, template < typename > class TABLE >
44  const MultiDimPartialInstantiation< GUM_SCALAR, TABLE >& from) {
45  // for debugging purposes
46  GUM_CONS_CPY(MultiDimPartialInstantiation);
47  }
48 
49  // destructor
50  template < typename GUM_SCALAR, template < typename > class TABLE >
51  MultiDimPartialInstantiation< GUM_SCALAR,
52  TABLE >::~MultiDimPartialInstantiation() {
53  // for debugging purposes
54  GUM_DESTRUCTOR(MultiDimPartialInstantiation);
55  }
56 
57  // virtual constructor
58  template < typename GUM_SCALAR, template < typename > class TABLE >
59  MultiDimPartialInstantiation< GUM_SCALAR, TABLE >*
61  return new MultiDimPartialInstantiation< GUM_SCALAR, TABLE >(*this);
62  }
63 
64  // copy operator
65  template < typename GUM_SCALAR, template < typename > class TABLE >
66  MultiDimPartialInstantiation< GUM_SCALAR, TABLE >&
68  operator=(const MultiDimPartialInstantiation< GUM_SCALAR, TABLE >& from) {
69  return *this;
70  }
71 
72  // creates and returns the partial instantiation of the table
73  template < typename GUM_SCALAR, template < typename > class TABLE >
74  TABLE< GUM_SCALAR >*
76  const TABLE< GUM_SCALAR >& table,
77  const HashTable< const DiscreteVariable*, Idx >& inst_vars) {
78  MultiDimImplementation< GUM_SCALAR >* new_impl =
79  partialInstantiation(table, inst_vars);
80  return new TABLE< GUM_SCALAR >(new_impl);
81  }
82 
83  // creates and returns the partial instantiation of the table
84  template < typename GUM_SCALAR, template < typename > class TABLE >
86  TABLE< GUM_SCALAR >& container,
87  const TABLE< GUM_SCALAR >& table,
88  const HashTable< const DiscreteVariable*, Idx >& inst_vars) {
89  MultiDimImplementation< GUM_SCALAR >* new_impl =
90  partialInstantiation(table, inst_vars);
91  container = *new_impl;
92  delete new_impl;
93  }
94 
95 } /* namespace gum */
96 
97 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
MultiDimPartialInstantiation()
Default constructor.
MultiDimPartialInstantiation< GUM_SCALAR, TABLE > & operator=(const MultiDimPartialInstantiation< GUM_SCALAR, TABLE > &src)
Copy operator.
gum is the global namespace for all aGrUM entities
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