aGrUM  0.20.2
a C++ library for (probabilistic) graphical models
PRMFormAttribute.h
Go to the documentation of this file.
1 /**
2  *
3  * Copyright 2005-2020 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::PRMFormAttribute.
25  *
26  * @author Lionel TORTI and Pierre-Henri WUILLEMIN(@LIP6)
27  */
28 
29 #ifndef GUM_FORM_ATTRIBUTE_H
30 #define GUM_FORM_ATTRIBUTE_H
31 
32 #include <agrum/PRM/elements/PRMAttribute.h>
33 
34 #include <agrum/PRM/elements/PRMClass.h>
35 
36 namespace gum {
37  namespace prm {
38 
39  /**
40  * @class PRMFormAttribute formAttribute.h
41  *<agrum/PRM/elements/formAttribute.h>
42  * @brief PRMFormAttribute is a member of a Class in a PRM.
43  *
44  * @see PRM PRMFactory Class PRMClassElement PRMType<GUM_SCALAR> Potential
45  *PRMAttribute
46  * @ingroup prm_group
47  */
48  template < typename GUM_SCALAR >
50  public:
51  PRMFormAttribute(const PRMClass< GUM_SCALAR >& c,
52  const std::string& name,
53  const PRMType& type,
54  MultiDimImplementation< std::string >* impl
55  = new MultiDimArray< std::string >());
56 
57  virtual ~PRMFormAttribute();
58 
59  /// See gum::prm::PRMAttribute.
60  virtual PRMAttribute< GUM_SCALAR >*
61  newFactory(const PRMClass< GUM_SCALAR >& c) const;
62 
63  /// See gum::prm::PRMAttribute.
64  virtual PRMAttribute< GUM_SCALAR >* copy(
65  Bijection< const DiscreteVariable*, const DiscreteVariable* > bij) const;
66 
67  /// See gum::prm::PRMAttribute.
68  virtual void copyCpf(
69  const Bijection< const DiscreteVariable*, const DiscreteVariable* >& bif,
70  const PRMAttribute< GUM_SCALAR >& source);
71 
72  /// See gum::prm::PRMAttribute.
73  virtual typename PRMClassElement< GUM_SCALAR >::ClassElementType
74  elt_type() const;
75 
76  /// See gum::prm::PRMAttribute.
77  virtual PRMType& type();
78 
79  /// See gum::prm::PRMAttribute.
80  virtual const PRMType& type() const;
81 
82  /// See gum::prm::PRMAttribute.
83  virtual const Potential< GUM_SCALAR >& cpf() const;
84 
85  /// See gum::prm::PRMAttribute.
86  virtual void addParent(const PRMClassElement< GUM_SCALAR >& elt);
87 
88  /// See gum::prm::PRMAttribute.
89  virtual void addChild(const PRMClassElement< GUM_SCALAR >& elt);
90 
91  /// See gum::prm::PRMAttribute.
92  virtual PRMAttribute< GUM_SCALAR >* getCastDescendant() const;
93 
94  /// See gum::prm::PRMAttribute.
95  virtual void setAsCastDescendant(PRMAttribute< GUM_SCALAR >* attr);
96  virtual void becomeCastDescendant(PRMType& subtype);
97 
99  virtual const MultiDimImplementation< std::string >& formulas() const;
100 
101  /// Swap old_type with new_type in the PRMClassElement cpt.
102  virtual void swap(const PRMType& old_type, const PRMType& new_type);
103 
104  protected:
105  virtual PRMType* type_();
106  virtual void type_(PRMType* t);
107 
108  private:
109  PRMFormAttribute(const PRMFormAttribute& source);
110  PRMFormAttribute& operator=(const PRMFormAttribute& source);
111 
112  /// The random variable type of this attribute
114 
115  /// A pointer on the Potential of this attribute
117 
118  /// A pointer on the Potential of this attribute
120 
121  /// A pointe toward the class of this attribute
123 
124  void fillCpf__() const;
125  };
126 
127 
128 #ifndef GUM_NO_EXTERN_TEMPLATE_CLASS
129  extern template class PRMFormAttribute< double >;
130 #endif
131 
132 
133  } /* namespace prm */
134 } // namespace gum
135 
136 #include <agrum/PRM/elements/PRMFormAttribute_tpl.h>
137 
138 #endif /* GUM_ATTRIBUTE_H */
virtual void addParent(const PRMClassElement< GUM_SCALAR > &elt)
See gum::prm::PRMAttribute.
virtual void setAsCastDescendant(PRMAttribute< GUM_SCALAR > *attr)
See gum::prm::PRMAttribute.
virtual void swap(const PRMType &old_type, const PRMType &new_type)
Swap old_type with new_type in the PRMClassElement cpt.
INLINE void emplace(Args &&... args)
Definition: set_tpl.h:669
virtual PRMAttribute< GUM_SCALAR > * newFactory(const PRMClass< GUM_SCALAR > &c) const
See gum::prm::PRMAttribute.
virtual void type_(PRMType *t)
virtual const PRMType & type() const
See gum::prm::PRMAttribute.
PRMFormAttribute(const PRMFormAttribute &source)
virtual PRMClassElement< GUM_SCALAR >::ClassElementType elt_type() const
See gum::prm::PRMAttribute.
virtual MultiDimImplementation< std::string > & formulas()
virtual void copyCpf(const Bijection< const DiscreteVariable *, const DiscreteVariable * > &bif, const PRMAttribute< GUM_SCALAR > &source)
See gum::prm::PRMAttribute.
PRMFormAttribute & operator=(const PRMFormAttribute &source)
virtual PRMAttribute< GUM_SCALAR > * getCastDescendant() const
See gum::prm::PRMAttribute.
const PRMClass< GUM_SCALAR > * class__
A pointe toward the class of this attribute.
virtual const Potential< GUM_SCALAR > & cpf() const
See gum::prm::PRMAttribute.
PRMFormAttribute(const PRMClass< GUM_SCALAR > &c, const std::string &name, const PRMType &type, MultiDimImplementation< std::string > *impl=new MultiDimArray< std::string >())
MultiDimImplementation< std::string > * formulas__
A pointer on the Potential of this attribute.
virtual void addChild(const PRMClassElement< GUM_SCALAR > &elt)
See gum::prm::PRMAttribute.
ParamScopeData(const std::string &s, const PRMReferenceSlot< GUM_SCALAR > &ref, Idx d)
virtual PRMAttribute< GUM_SCALAR > * copy(Bijection< const DiscreteVariable *, const DiscreteVariable * > bij) const
See gum::prm::PRMAttribute.
virtual void becomeCastDescendant(PRMType &subtype)
Change this attribute to be a cast descendant of a an attribute with type subtype.
Potential< GUM_SCALAR > * cpf__
A pointer on the Potential of this attribute.
virtual const MultiDimImplementation< std::string > & formulas() const
virtual PRMType & type()
See gum::prm::PRMAttribute.
PRMType * type__
The random variable type of this attribute.