aGrUM  0.16.0
exists_tpl.h
Go to the documentation of this file.
1 
30 #include <sstream>
31 // to ease parser in IDEs
33 
34 namespace gum {
35 
36  namespace aggregator {
37  template < typename GUM_SCALAR >
39  MultiDimAggregator< GUM_SCALAR >(), __value(value) {
40  GUM_CONSTRUCTOR(Exists);
41  }
42 
43  template < typename GUM_SCALAR >
45  MultiDimAggregator< GUM_SCALAR >(from) {
46  __value = from.__value;
47  GUM_CONS_CPY(Exists);
48  }
49 
50  template < typename GUM_SCALAR >
52  GUM_DESTRUCTOR(Exists);
53  }
54 
55  template < typename GUM_SCALAR >
57  return (Idx)0;
58  }
59 
60  template < typename GUM_SCALAR >
62  Idx i1,
63  Idx i2,
64  bool& stop_iteration) const {
65  if (i1 != __value) {
66  return (Idx)0;
67  } else {
68  stop_iteration = true;
69  return (Idx)1;
70  }
71  }
72 
73  template < typename GUM_SCALAR >
74  INLINE
75 
76  std::string
78  std::stringstream ss;
79  ss << "exists[" << __value << "]";
80  return ss.str();
81  }
82 
83  template < typename GUM_SCALAR >
86  return new Exists< GUM_SCALAR >(__value);
87  }
88 
89  } // namespace aggregator
90 } // namespace gum
virtual Idx _neutralElt() const
_neutralElt() is the result value for the first application of _fold
Definition: exists_tpl.h:56
virtual std::string aggregatorName() const
Definition: exists_tpl.h:77
Base class for discrete random variable.
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
Definition: agrum.h:25
Abstract base class for all multi dimensionnal containers.
virtual Idx _fold(const DiscreteVariable &v, Idx i1, Idx i2, bool &stop_iteration) const
_fold is applied on value i1 for variable v. the actual result for precedent applications is i2...
Definition: exists_tpl.h:61
<agrum/multidim/aggregators/multiDimAggregator.h>
virtual MultiDimContainer< GUM_SCALAR > * newFactory() const
This method creates a clone of this object, withouth its content (including variable), you must use this method if you want to ensure that the generated object has the same type than the object containing the called newFactory()
Definition: exists_tpl.h:85
exists aggregator
Definition: exists.h:54
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
Size Idx
Type for indexes.
Definition: types.h:53