aGrUM  0.21.0
a C++ library for (probabilistic) graphical models
PRMFuncAttribute.h
Go to the documentation of this file.
1 /**
2  *
3  * Copyright (c) 2005-2021 by Pierre-Henri WUILLEMIN(@LIP6) & Christophe GONZALES(@AMU)
4  * info_at_agrum_dot_org
5  *
6  * This library is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU Lesser General Public License as published by
8  * the Free Software Foundation, either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public License
17  * along with this library. If not, see <http://www.gnu.org/licenses/>.
18  *
19  */
20 
21 
22 /**
23  * @file
24  * @brief Headers of gum::PRMAttribute.
25  *
26  * @author Lionel TORTI and Pierre-Henri WUILLEMIN(@LIP6)
27  */
28 
29 #ifndef GUM_FUNC_ATTRIBUTE_H
30 #define GUM_FUNC_ATTRIBUTE_H
31 
32 #include <agrum/PRM/elements/PRMType.h>
33 
34 #include <agrum/PRM/elements/PRMScalarAttribute.h>
35 #include <agrum/tools/multidim/implementations/multiDimImplementation.h>
36 #include <agrum/tools/multidim/potential.h>
37 
38 namespace gum {
39  namespace prm {
40 
41  /**
42  * @class PRMFuncAttribute funcAttribute.h
43  *<agrum/PRM/elements/funcAttribute.h>
44  * @brief This class overload gum::prm::PRMClassElement::addParent_() and
45  * gum::prm::PRMClassElement::addChild_ with empty methods.
46  *
47  * This class should be used when dealing with functions such as Noisy-Or
48  *which
49  * require special method calls to add parents.
50  * When dealing with such attributes, you should create the MultiDim
51  *yourself and
52  * populate it with the attribute's parents.
53  *
54  * See gum::prm::PRMFactory::addAttribute(PRMAttribute*) for more details.
55  */
56  template < typename GUM_SCALAR >
58  public:
59  /**
60  * @brief Constructor used by gum::Class.
61  * This will create an PRMFuncAttribute with only one variable: type and
62  *with
63  *the given
64  * implementation.
65  *
66  * @param name The name of this PRMFuncAttribute.
67  * @param type The type of this PRMFuncAttribute, it is copied.
68  * @param impl The MultiDimImplementation used by the internal Potential
69  *of this PRMFuncAttribute.
70  * it will be deleted after the call of ~PRMFuncAttribute.
71  */
72  PRMFuncAttribute(const std::string& name,
73  const PRMType& type,
74  MultiDimImplementation< GUM_SCALAR >* impl
75  = new MultiDimArray< GUM_SCALAR >());
76 
77  /// Destructor.
78  virtual ~PRMFuncAttribute();
79 
80  /// See gum::PRMClassElement::addParent_().
81  virtual void addParent(const PRMClassElement< GUM_SCALAR >& elt);
82 
83  /// See gum::PRMClassElement::addChild_().
84  virtual void addChild(const PRMClassElement< GUM_SCALAR >& elt);
85 
86  protected:
87  /// Copy constructor. Don't use it.
88  PRMFuncAttribute(const PRMFuncAttribute< GUM_SCALAR >& source);
89 
90  /// Copy operator. Don't use it.
91  PRMFuncAttribute< GUM_SCALAR >& operator=(const PRMFuncAttribute< GUM_SCALAR >& from);
92 
93  virtual void setCpf_(Potential< GUM_SCALAR >* cpf);
94  };
95 
96 
97 #ifndef GUM_NO_EXTERN_TEMPLATE_CLASS
98  extern template class PRMFuncAttribute< double >;
99 #endif
100 
101 
102  } /* namespace prm */
103 } // namespace gum
104 
105 #include <agrum/PRM/elements/PRMFuncAttribute_tpl.h>
106 
107 #endif /* GUM_FUNC_ATTRIBUTE_H */
INLINE void emplace(Args &&... args)
Definition: set_tpl.h:643
PRMFuncAttribute< GUM_SCALAR > & operator=(const PRMFuncAttribute< GUM_SCALAR > &from)
Copy operator. Don&#39;t use it.
virtual void addChild(const PRMClassElement< GUM_SCALAR > &elt)
See gum::PRMClassElement::addChild_().
virtual void setCpf_(Potential< GUM_SCALAR > *cpf)
<agrum/PRM/elements/funcAttribute.h>
ParamScopeData(const std::string &s, const PRMReferenceSlot< GUM_SCALAR > &ref, Idx d)
PRMFuncAttribute(const std::string &name, const PRMType &type, MultiDimImplementation< GUM_SCALAR > *impl=new MultiDimArray< GUM_SCALAR >())
Constructor used by gum::Class.
virtual ~PRMFuncAttribute()
Destructor.
PRMFuncAttribute(const PRMFuncAttribute< GUM_SCALAR > &source)
Copy constructor. Don&#39;t use it.
virtual void addParent(const PRMClassElement< GUM_SCALAR > &elt)
See gum::PRMClassElement::addParent_().