aGrUM  0.14.2
PRMFormAttribute.h
Go to the documentation of this file.
1 /***************************************************************************
2  * Copyright (C) 2005 by Christophe GONZALES and Pierre-Henri WUILLEMIN *
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  ***************************************************************************/
27 #ifndef GUM_FORM_ATTRIBUTE_H
28 #define GUM_FORM_ATTRIBUTE_H
29 
31 
33 
34 namespace gum {
35  namespace prm {
36 
46  template < typename GUM_SCALAR >
47  class PRMFormAttribute : public PRMAttribute< GUM_SCALAR > {
48  public:
50  const std::string& name,
51  const PRMType& type,
54 
55  virtual ~PRMFormAttribute();
56 
59  newFactory(const PRMClass< GUM_SCALAR >& c) const;
60 
64 
66  virtual void copyCpf(
68  const PRMAttribute< GUM_SCALAR >& source);
69 
72  elt_type() const;
73 
75  virtual PRMType& type();
76 
78  virtual const PRMType& type() const;
79 
81  virtual const Potential< GUM_SCALAR >& cpf() const;
82 
84  virtual void addParent(const PRMClassElement< GUM_SCALAR >& elt);
85 
87  virtual void addChild(const PRMClassElement< GUM_SCALAR >& elt);
88 
91 
94  virtual void becomeCastDescendant(PRMType& subtype);
95 
97  virtual const MultiDimImplementation< std::string >& formulas() const;
98 
100  virtual void swap(const PRMType& old_type, const PRMType& new_type);
101 
102  protected:
103  virtual PRMType* _type();
104  virtual void _type(PRMType* t);
105 
106  private:
107  PRMFormAttribute(const PRMFormAttribute& source);
109 
112 
115 
118 
121 
122  void __fillCpf() const;
123  };
124 
125 
126 #ifndef GUM_NO_EXTERN_TEMPLATE_CLASS
127  extern template class PRMFormAttribute< double >;
128 #endif
129 
130 
131  } /* namespace prm */
132 } // namespace gum
133 
135 
136 #endif /* GUM_ATTRIBUTE_H */
virtual void addParent(const PRMClassElement< GUM_SCALAR > &elt)
See gum::prm::PRMAttribute.
Potential< GUM_SCALAR > * __cpf
A pointer on the Potential of this attribute.
aGrUM&#39;s Potential is a multi-dimensional array with tensor operators.
Definition: potential.h:57
MultiDimImplementation< std::string > * __formulas
A pointer on the Potential of this attribute.
virtual void setAsCastDescendant(PRMAttribute< GUM_SCALAR > *attr)
See gum::prm::PRMAttribute.
const std::string & name() const
Returns the name of this object.
Definition: PRMObject_inl.h:32
virtual void swap(const PRMType &old_type, const PRMType &new_type)
Swap old_type with new_type in the PRMClassElement cpt.
virtual PRMAttribute< GUM_SCALAR > * newFactory(const PRMClass< GUM_SCALAR > &c) const
See gum::prm::PRMAttribute.
Headers of gum::prm::Class<GUM_SCALAR>.
Abstract class representing an element of PRM class.
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.
gum is the global namespace for all aGrUM entities
Definition: agrum.h:25
PRMFormAttribute & operator=(const PRMFormAttribute &source)
virtual PRMAttribute< GUM_SCALAR > * getCastDescendant() const
See gum::prm::PRMAttribute.
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 >())
virtual void addChild(const PRMClassElement< GUM_SCALAR > &elt)
See gum::prm::PRMAttribute.
Multidimensional matrix stored as an array in memory.
Definition: multiDimArray.h:51
Set of pairs of elements with fast search for both elements.
Definition: bijection.h:1803
This is a decoration of the DiscreteVariable class.
Definition: PRMType.h:60
virtual PRMAttribute< GUM_SCALAR > * copy(Bijection< const DiscreteVariable *, const DiscreteVariable * > bij) const
See gum::prm::PRMAttribute.
PRMType * __type
The random variable type of this attribute.
Headers of gum::PRMAttribute.
const PRMClass< GUM_SCALAR > * __class
A pointe toward the class of this attribute.
A PRMClass is an object of a PRM representing a fragment of a Bayesian Network which can be instantia...
Definition: PRMClass.h:63
virtual void becomeCastDescendant(PRMType &subtype)
Change this attribute to be a cast descendant of a an attribute with type subtype.
PRMAttribute is a member of a Class in a PRM.
Definition: PRMAttribute.h:58
<agrum/PRM/elements/formAttribute.h>
virtual PRMType & type()
See gum::prm::PRMAttribute.
Inline implementation of gum::PRMFormAttribute.
ClassElementType
Returns true if obj_ptr is of type PRMReferenceSlot.