aGrUM 2.3.2
a C++ library for (probabilistic) graphical models
PRMAttribute.h
Go to the documentation of this file.
1/****************************************************************************
2 * This file is part of the aGrUM/pyAgrum library. *
3 * *
4 * Copyright (c) 2005-2025 by *
5 * - Pierre-Henri WUILLEMIN(_at_LIP6) *
6 * - Christophe GONZALES(_at_AMU) *
7 * *
8 * The aGrUM/pyAgrum library is free software; you can redistribute it *
9 * and/or modify it under the terms of either : *
10 * *
11 * - the GNU Lesser General Public License as published by *
12 * the Free Software Foundation, either version 3 of the License, *
13 * or (at your option) any later version, *
14 * - the MIT license (MIT), *
15 * - or both in dual license, as here. *
16 * *
17 * (see https://agrum.gitlab.io/articles/dual-licenses-lgplv3mit.html) *
18 * *
19 * This aGrUM/pyAgrum library is distributed in the hope that it will be *
20 * useful, but WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, *
21 * INCLUDING BUT NOT LIMITED TO THE WARRANTIES MERCHANTABILITY or FITNESS *
22 * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE *
23 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *
24 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, *
25 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR *
26 * OTHER DEALINGS IN THE SOFTWARE. *
27 * *
28 * See LICENCES for more details. *
29 * *
30 * SPDX-FileCopyrightText: Copyright 2005-2025 *
31 * - Pierre-Henri WUILLEMIN(_at_LIP6) *
32 * - Christophe GONZALES(_at_AMU) *
33 * SPDX-License-Identifier: LGPL-3.0-or-later OR MIT *
34 * *
35 * Contact : info_at_agrum_dot_org *
36 * homepage : http://agrum.gitlab.io *
37 * gitlab : https://gitlab.com/agrumery/agrum *
38 * *
39 ****************************************************************************/
40
41
48
49#ifndef GUM_ATTRIBUTE_H
50#define GUM_ATTRIBUTE_H
51
53
54namespace gum {
55 namespace prm {
56
78 template < typename GUM_SCALAR >
79 class PRMAttribute: public PRMClassElement< GUM_SCALAR > {
80 public:
81 // ========================================================================
83 // ========================================================================
85 explicit PRMAttribute(const std::string& name);
86
88 virtual ~PRMAttribute();
89
91 // ========================================================================
93 // ========================================================================
95
99 = 0;
100
102 const PRMAttribute< GUM_SCALAR >& source)
103 = 0;
104
107
109 virtual PRMType& type() = 0;
110
112 virtual const PRMType& type() const = 0;
113
115 virtual const Tensor< GUM_SCALAR >& cpf() const = 0;
116
118 virtual void addParent(const PRMClassElement< GUM_SCALAR >& elt) = 0;
119
121 virtual void addChild(const PRMClassElement< GUM_SCALAR >& elt) = 0;
122
140
174
180 virtual void becomeCastDescendant(PRMType& subtype) = 0;
181
183 virtual void swap(const PRMType& old_type, const PRMType& new_type) = 0;
184
187 virtual void overload(PRMAttribute< GUM_SCALAR >* source);
188
190
191 protected:
193
194 virtual PRMType* type_() = 0;
195 virtual void type_(PRMType* t) = 0;
196 };
197
198
199#ifndef GUM_NO_EXTERN_TEMPLATE_CLASS
200 extern template class PRMAttribute< double >;
201#endif
202
203
204 } /* namespace prm */
205} // namespace gum
206
208
209#endif /* GUM_ATTRIBUTE_H */
Inline implementation of gum::PRMAttribute.
Headers of gum::PRMClassElement.
Set of pairs of elements with fast search for both elements.
Definition bijection.h:1594
virtual PRMAttribute< GUM_SCALAR > * newFactory(const PRMClass< GUM_SCALAR > &c) const =0
See gum::PRMClassElement::elt_type().
virtual const Tensor< GUM_SCALAR > & cpf() const =0
See gum::PRMClassElement::cpf().
virtual void overload(PRMAttribute< GUM_SCALAR > *source)
Set this as overload of source (necessayr to preserver internal pointers for MultiDims).
virtual void copyCpf(const Bijection< const DiscreteVariable *, const DiscreteVariable * > &bif, const PRMAttribute< GUM_SCALAR > &source)=0
See gum::PRMClassElement::elt_type().
virtual void setAsCastDescendant(PRMAttribute< GUM_SCALAR > *attr)=0
Define attr as a cast descendant of this PRMAttribute.
PRMAttribute(const std::string &name)
Destructor.
virtual void type_(PRMType *t)=0
virtual ~PRMAttribute()
Destructor.
virtual PRMClassElement< GUM_SCALAR >::ClassElementType elt_type() const =0
See gum::PRMClassElement::elt_type().
virtual void addParent(const PRMClassElement< GUM_SCALAR > &elt)=0
See gum::PRMClassElement::addParent_().
virtual void swap(const PRMType &old_type, const PRMType &new_type)=0
Swap old_type with new_type in the PRMClassElement cpt.
virtual PRMType * type_()=0
virtual void addChild(const PRMClassElement< GUM_SCALAR > &elt)=0
See gum::PRMClassElement::addChild_().
virtual const PRMType & type() const =0
See gum::PRMClassElement::type().
virtual void becomeCastDescendant(PRMType &subtype)=0
Change this attribute to be a cast descendant of a an attribute with type subtype.
virtual PRMAttribute< GUM_SCALAR > * getCastDescendant() const =0
Returns a proper cast descendant of this PRMAttribute.
virtual PRMAttribute< GUM_SCALAR > * copy(Bijection< const DiscreteVariable *, const DiscreteVariable * > bij) const =0
See gum::PRMClassElement::elt_type().
virtual PRMType & type()=0
See gum::PRMClassElement::type().
PRMClassElement(const std::string &name)
Default constructor of a PRMClassElement.
ClassElementType
Returns true if obj_ptr is of type PRMReferenceSlot.
A PRMClass is an object of a PRM representing a fragment of a Bayesian network which can be instantia...
Definition PRMClass.h:75
const std::string & name() const
Returns the name of this object.
This is a decoration of the DiscreteVariable class.
Definition PRMType.h:78
namespace for all probabilistic relational models entities
Definition agrum.h:68
gum is the global namespace for all aGrUM entities
Definition agrum.h:46