aGrUM 2.3.2
a C++ library for (probabilistic) graphical models
PRMSlotChain.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_SLOT_CHAIN_H
50#define GUM_SLOT_CHAIN_H
51
52#include <string>
53
56
57namespace gum {
58 namespace prm {
59
60 template < typename GUM_SCALAR >
61 class PRMClass;
62 template < typename GUM_SCALAR >
63 class PRMAttribute;
64
89 // ==========================================================================
90 template < typename GUM_SCALAR >
91 class PRMSlotChain: public PRMClassElement< GUM_SCALAR > {
92 public:
93 // ========================================================================
95 // ========================================================================
97
115 PRMSlotChain(const std::string& name,
117
136
143
145 virtual ~PRMSlotChain();
146
148 // ========================================================================
150 // ========================================================================
152
155
157 virtual PRMType& type();
158
160 virtual const PRMType& type() const;
161
162 // /// This is similar to the following call: this->lastElt().cpf()
163 // virtual Tensor<GUM_SCALAR>& cpf();
164
166 virtual const Tensor< GUM_SCALAR >& cpf() const;
167
170 bool isMultiple() const;
171
175
179
183
187
191
195
197 virtual void addParent(const PRMClassElement< GUM_SCALAR >& elt);
198
200 virtual void addChild(const PRMClassElement< GUM_SCALAR >& elt);
201
206
207 private:
209 PRMSlotChain& operator=(const PRMSlotChain& source);
210
211 // ========================================================================
213 // ========================================================================
215
218
221
224 void _copyLastElt_();
225
227 };
228
229
230#ifndef GUM_NO_EXTERN_TEMPLATE_CLASS
231 extern template class PRMSlotChain< double >;
232#endif
233
234
235 } /* namespace prm */
236} // namespace gum
237
239
240#endif /* GUM_SLOT_CHAIN_H */
Headers of gum::PRMAggregate.
Headers of gum::PRMClassElement.
Inline implementation of gum::PRMSlotChain<GUM_SCALAR>.
The generic class for storing (ordered) sequences of objects.
Definition sequence.h:972
PRMAttribute is a member of a Class in a PRM.
<agrum/PRM/classElementContainer.h>
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.
PRMSlotChain(const std::string &name, const Sequence< PRMClassElement< GUM_SCALAR > * > &chain)
Default constructor.
bool _isMultiple_
Flag indicating if this slot chain is multiple or not.
void _copyLastElt_()
Copy the last element, this prevents unwanted DuplicateElement exceptions.
Sequence< PRMClassElement< GUM_SCALAR > * > & chain()
Return the sequence representing the chain of elements in this PRMSlotChain.
virtual void addChild(const PRMClassElement< GUM_SCALAR > &elt)
See gum::PRMClassElement<GUM_SCALAR>::addChild_().
Sequence< PRMClassElement< GUM_SCALAR > * > * _chain_
The sequence of PRMClassElement<GUM_SCALAR> composing the slot chain.
virtual void addParent(const PRMClassElement< GUM_SCALAR > &elt)
See gum::PRMClassElement<GUM_SCALAR>::addParent_().
PRMClassElementContainer< GUM_SCALAR > & end()
Returns the PRMClassElement<GUM_SCALAR>Container over which this slot chain ends.
virtual PRMAttribute< GUM_SCALAR > * getCastDescendant() const
Raise a gum::OperationNotAllowed exception See gum::PRMClassElement<GUM_SCALAR>::getCastDescendant().
PRMClassElement< GUM_SCALAR > & lastElt()
Returns the last element of the slot chain, typically this is an gum::PRMAttribute or a gum::PRMAggre...
virtual PRMType & type()
This is similar to the following call: this->lastElt().type().
virtual PRMClassElement< GUM_SCALAR >::ClassElementType elt_type() const
See gum::PRMClassElement<GUM_SCALAR>::elt_type().
PRMSlotChain & operator=(const PRMSlotChain &source)
Copy operator. Don't use it.
virtual ~PRMSlotChain()
Destructor.
virtual const Tensor< GUM_SCALAR > & cpf() const
This is similar to the following call: this->lastElt().cpf().
bool isMultiple() const
Return true if this slot chain contains at least one multiple reference slot.
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