aGrUM  0.14.2
multiDimCompleteProjection_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  ***************************************************************************/
28 #ifndef DOXYGEN_SHOULD_SKIP_THIS
29 
30 # include <agrum/agrum.h>
31 # include <limits>
32 
33 namespace gum {
34 
35  // constructor
36  template < typename GUM_SCALAR, template < typename > class TABLE >
38  GUM_SCALAR (*proj)(const TABLE< GUM_SCALAR >&, Instantiation*)) :
39  _proj(proj) {
40  // for debugging purposes
41  GUM_CONSTRUCTOR(MultiDimCompleteProjection);
42  }
43 
44  // copy constructor
45  template < typename GUM_SCALAR, template < typename > class TABLE >
47  const MultiDimCompleteProjection< GUM_SCALAR, TABLE >& from) :
48  _proj(from._proj) {
49  // for debugging purposes
50  GUM_CONS_CPY(MultiDimCompleteProjection);
51  }
52 
53  // destructor
54  template < typename GUM_SCALAR, template < typename > class TABLE >
56  // for debugging purposes
57  GUM_DESTRUCTOR(MultiDimCompleteProjection);
58  }
59 
60  // virtual constructor
61  template < typename GUM_SCALAR, template < typename > class TABLE >
62  MultiDimCompleteProjection< GUM_SCALAR, TABLE >*
64  return new MultiDimCompleteProjection< GUM_SCALAR, TABLE >(*this);
65  }
66 
67  // creates and returns the projection of the table over a subset of its vars
68  template < typename GUM_SCALAR, template < typename > class TABLE >
70  const TABLE< GUM_SCALAR >& table, Instantiation* inst) {
71  return _proj(table, inst);
72  }
73 
74  // changes the function used for projecting TABLES
75  template < typename GUM_SCALAR, template < typename > class TABLE >
77  GUM_SCALAR (*proj)(const TABLE< GUM_SCALAR >&, Instantiation*)) {
78  _proj = proj;
79  }
80 
81  // returns the projection function currently used by the projector
82  template < typename GUM_SCALAR, template < typename > class TABLE >
83  INLINE GUM_SCALAR (
84  *MultiDimCompleteProjection< GUM_SCALAR, TABLE >::projectFunction())(
85  const TABLE< GUM_SCALAR >&, Instantiation*) {
86  return _proj;
87  }
88 
89 } /* namespace gum */
90 
91 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
virtual MultiDimCompleteProjection< GUM_SCALAR, TABLE > * newFactory() const
Virtual constructor.
gum is the global namespace for all aGrUM entities
Definition: agrum.h:25
virtual ~MultiDimCompleteProjection()
Destructor.
GUM_SCALAR(* _proj)(const TABLE< GUM_SCALAR > &, Instantiation *)
The projection function actually used.
GUM_SCALAR project(const TABLE< GUM_SCALAR > &table, Instantiation *instantiation=0)
Creates and returns the projection of the table over all of its vars.
void setProjectFunction(GUM_SCALAR(*proj)(const TABLE< GUM_SCALAR > &, Instantiation *))
Changes the function used for projecting TABLES.
MultiDimCompleteProjection(GUM_SCALAR(*proj)(const TABLE< GUM_SCALAR > &, Instantiation *))
Default constructor.