aGrUM  0.14.2
PRMAttribute.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_ATTRIBUTE_H
28 #define GUM_ATTRIBUTE_H
29 
32 
33 namespace gum {
34  namespace prm {
35 
57  template < typename GUM_SCALAR >
58  class PRMAttribute : public PRMClassElement< GUM_SCALAR > {
59  public:
60  // ========================================================================
62  // ========================================================================
64  explicit PRMAttribute(const std::string& name);
65 
67  virtual ~PRMAttribute();
68 
70  // ========================================================================
72  // ========================================================================
74 
76  newFactory(const PRMClass< GUM_SCALAR >& c) const = 0;
79  const = 0;
80 
81  virtual void copyCpf(
83  const PRMAttribute< GUM_SCALAR >& source) = 0;
84 
87  elt_type() const = 0;
88 
90  virtual PRMType& type() = 0;
91 
93  virtual const PRMType& type() const = 0;
94 
96  virtual const Potential< GUM_SCALAR >& cpf() const = 0;
97 
99  virtual void addParent(const PRMClassElement< GUM_SCALAR >& elt) = 0;
100 
102  virtual void addChild(const PRMClassElement< GUM_SCALAR >& elt) = 0;
103 
120  virtual PRMAttribute< GUM_SCALAR >* getCastDescendant() const = 0;
121 
154  virtual void setAsCastDescendant(PRMAttribute< GUM_SCALAR >* attr) = 0;
155 
161  virtual void becomeCastDescendant(PRMType& subtype) = 0;
162 
164  virtual void swap(const PRMType& old_type, const PRMType& new_type) = 0;
165 
168  virtual void overload(PRMAttribute< GUM_SCALAR >* source);
169 
171 
172  protected:
174 
175  virtual PRMType* _type() = 0;
176  virtual void _type(PRMType* t) = 0;
177  };
178 
179 
180 #ifndef GUM_NO_EXTERN_TEMPLATE_CLASS
181  extern template class PRMAttribute< double >;
182 #endif
183 
184 
185  } /* namespace prm */
186 } // namespace gum
187 
189 
190 #endif /* GUM_ATTRIBUTE_H */
aGrUM&#39;s Potential is a multi-dimensional array with tensor operators.
Definition: potential.h:57
virtual PRMAttribute< GUM_SCALAR > * getCastDescendant() const =0
Returns a proper cast descendant of this PRMAttribute.
PRMAttribute(const std::string &name)
Destructor.
virtual void addParent(const PRMClassElement< GUM_SCALAR > &elt)=0
See gum::PRMClassElement::_addParent().
const std::string & name() const
Returns the name of this object.
Definition: PRMObject_inl.h:32
virtual PRMAttribute< GUM_SCALAR > * copy(Bijection< const DiscreteVariable *, const DiscreteVariable * > bij) const =0
See gum::PRMClassElement::elt_type().
virtual PRMAttribute< GUM_SCALAR > * newFactory(const PRMClass< GUM_SCALAR > &c) const =0
See gum::PRMClassElement::elt_type().
virtual PRMType & type()=0
See gum::PRMClassElement::type().
Abstract class representing an element of PRM class.
virtual ~PRMAttribute()
Destructor.
virtual PRMType * _type()=0
gum is the global namespace for all aGrUM entities
Definition: agrum.h:25
Headers of gum::MultiDimImplementation.
virtual void becomeCastDescendant(PRMType &subtype)=0
Change this attribute to be a cast descendant of a an attribute with type subtype.
virtual void overload(PRMAttribute< GUM_SCALAR > *source)
Set this as overload of source (necessayr to preserver internal pointers for MultiDims).
virtual const Potential< GUM_SCALAR > & cpf() const =0
See gum::PRMClassElement::cpf().
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 PRMClassElement< GUM_SCALAR >::ClassElementType elt_type() const =0
See gum::PRMClassElement::elt_type().
virtual void addChild(const PRMClassElement< GUM_SCALAR > &elt)=0
See gum::PRMClassElement::_addChild().
Headers of gum::PRMClassElement.
virtual void swap(const PRMType &old_type, const PRMType &new_type)=0
Swap old_type with new_type in the PRMClassElement cpt.
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 setAsCastDescendant(PRMAttribute< GUM_SCALAR > *attr)=0
Define attr as a cast descendant of this PRMAttribute.
Inline implementation of gum::PRMAttribute.
virtual void copyCpf(const Bijection< const DiscreteVariable *, const DiscreteVariable * > &bif, const PRMAttribute< GUM_SCALAR > &source)=0
See gum::PRMClassElement::elt_type().
PRMAttribute is a member of a Class in a PRM.
Definition: PRMAttribute.h:58
ClassElementType
Returns true if obj_ptr is of type PRMReferenceSlot.