aGrUM  0.14.2
PRMScalarAttribute.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_SCALAR_ATTRIBUTE_H
28 #define GUM_SCALAR_ATTRIBUTE_H
29 
30 #include <agrum/agrum.h>
31 #include <agrum/core/bijection.h>
34 
35 
36 namespace gum {
37  namespace prm {
38 
63  template < typename GUM_SCALAR >
64  class PRMScalarAttribute : public PRMAttribute< GUM_SCALAR > {
65  public:
66  // ========================================================================
68  // ========================================================================
70 
83  PRMScalarAttribute(const std::string& name,
84  const PRMType& type,
87 
89  virtual ~PRMScalarAttribute();
90 
92  // ========================================================================
94  // ========================================================================
96 
98  newFactory(const PRMClass< GUM_SCALAR >& c) const;
101 
102  virtual void copyCpf(
104  const PRMAttribute< GUM_SCALAR >& source);
105 
108  elt_type() const;
109 
111  virtual PRMType& type();
112 
114  virtual const PRMType& type() const;
115 
117  virtual const Potential< GUM_SCALAR >& cpf() const;
118 
120  virtual void addParent(const PRMClassElement< GUM_SCALAR >& elt);
121 
123  virtual void addChild(const PRMClassElement< GUM_SCALAR >& elt);
124 
127  virtual void becomeCastDescendant(PRMType& subtype);
128 
130  virtual void swap(const PRMType& old_type, const PRMType& new_type);
131 
133  protected:
135  PRMScalarAttribute(const PRMScalarAttribute& source);
136 
139 
140  virtual PRMType* _type();
141  virtual void _type(PRMType* t);
142 
143  private:
144  // ========================================================================
146  // ========================================================================
148 
151 
154 
156  };
157 
158 
159 #ifndef GUM_NO_EXTERN_TEMPLATE_CLASS
160  extern template class PRMScalarAttribute< double >;
161 #endif
162 
163 
164  } /* namespace prm */
165 } // namespace gum
166 
168 
169 #endif /* GUM_SCALAR_ATTRIBUTE_H */
virtual void addChild(const PRMClassElement< GUM_SCALAR > &elt)
See gum::PRMClassElement::_addChild().
aGrUM&#39;s Potential is a multi-dimensional array with tensor operators.
Definition: potential.h:57
virtual void becomeCastDescendant(PRMType &subtype)
See gum::PRMClassElement::elt_type().
virtual ~PRMScalarAttribute()
Destructor.
virtual void swap(const PRMType &old_type, const PRMType &new_type)
Swap old_type with new_type in the PRMClassElement cpt.
const std::string & name() const
Returns the name of this object.
Definition: PRMObject_inl.h:32
Abstract class representing an element of PRM class.
virtual PRMType & type()
See gum::PRMClassElement::type().
gum is the global namespace for all aGrUM entities
Definition: agrum.h:25
virtual PRMAttribute< GUM_SCALAR > * newFactory(const PRMClass< GUM_SCALAR > &c) const
See gum::PRMClassElement::elt_type().
virtual PRMClassElement< GUM_SCALAR >::ClassElementType elt_type() const
See gum::PRMClassElement::elt_type().
virtual void copyCpf(const Bijection< const DiscreteVariable *, const DiscreteVariable * > &bif, const PRMAttribute< GUM_SCALAR > &source)
See gum::PRMClassElement::elt_type().
Inline implementation of gum::PRMScalarAttribute.
virtual const Potential< GUM_SCALAR > & cpf() const
See gum::PRMClassElement::cpf().
Header of the Potential class.
PRMType * __type
The random variable type of this attribute.
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::PRMClassElement::elt_type().
Headers of gum::PRMAttribute.
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)
See gum::PRMClassElement::elt_type().
Potential< GUM_SCALAR > * __cpf
A pointer on the Potential of this attribute.
virtual PRMAttribute< GUM_SCALAR > * getCastDescendant() const
See gum::PRMClassElement::elt_type().
<agrum/multidim/multiDimImplementation.h>
PRMAttribute is a member of a Class in a PRM.
Definition: PRMAttribute.h:58
virtual void addParent(const PRMClassElement< GUM_SCALAR > &elt)
See gum::PRMClassElement::_addParent().
<agrum/PRM/elements/scalarAttribute.h>
PRMScalarAttribute(const std::string &name, const PRMType &type, MultiDimImplementation< GUM_SCALAR > *impl=new MultiDimArray< GUM_SCALAR >())
Constructor used by gum::Class.
Set of pairs of elements with fast search for both elements.
PRMScalarAttribute & operator=(const PRMScalarAttribute &from)
Copy operator. Don&#39;t use it.
ClassElementType
Returns true if obj_ptr is of type PRMReferenceSlot.