aGrUM  0.16.0
multiDimCompleteProjection_tpl.h
Go to the documentation of this file.
1 
31 #ifndef DOXYGEN_SHOULD_SKIP_THIS
32 
33 # include <agrum/agrum.h>
34 # include <limits>
35 
36 namespace gum {
37 
38  // constructor
39  template < typename GUM_SCALAR, template < typename > class TABLE >
41  GUM_SCALAR (*proj)(const TABLE< GUM_SCALAR >&, Instantiation*)) :
42  _proj(proj) {
43  // for debugging purposes
44  GUM_CONSTRUCTOR(MultiDimCompleteProjection);
45  }
46 
47  // copy constructor
48  template < typename GUM_SCALAR, template < typename > class TABLE >
50  const MultiDimCompleteProjection< GUM_SCALAR, TABLE >& from) :
51  _proj(from._proj) {
52  // for debugging purposes
53  GUM_CONS_CPY(MultiDimCompleteProjection);
54  }
55 
56  // destructor
57  template < typename GUM_SCALAR, template < typename > class TABLE >
59  // for debugging purposes
60  GUM_DESTRUCTOR(MultiDimCompleteProjection);
61  }
62 
63  // virtual constructor
64  template < typename GUM_SCALAR, template < typename > class TABLE >
65  MultiDimCompleteProjection< GUM_SCALAR, TABLE >*
67  return new MultiDimCompleteProjection< GUM_SCALAR, TABLE >(*this);
68  }
69 
70  // creates and returns the projection of the table over a subset of its vars
71  template < typename GUM_SCALAR, template < typename > class TABLE >
73  const TABLE< GUM_SCALAR >& table, Instantiation* inst) {
74  return _proj(table, inst);
75  }
76 
77  // changes the function used for projecting TABLES
78  template < typename GUM_SCALAR, template < typename > class TABLE >
80  GUM_SCALAR (*proj)(const TABLE< GUM_SCALAR >&, Instantiation*)) {
81  _proj = proj;
82  }
83 
84  // returns the projection function currently used by the projector
85  template < typename GUM_SCALAR, template < typename > class TABLE >
86  INLINE GUM_SCALAR (
87  *MultiDimCompleteProjection< GUM_SCALAR, TABLE >::projectFunction())(
88  const TABLE< GUM_SCALAR >&, Instantiation*) {
89  return _proj;
90  }
91 
92 } /* namespace gum */
93 
94 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
virtual MultiDimCompleteProjection< GUM_SCALAR, TABLE > * newFactory() const
Virtual constructor.
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
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.