1 /**
2  *
3  *   Copyright (c) 2005-2021 by Pierre-Henri WUILLEMIN(_at_LIP6) & Christophe GONZALES(_at_AMU)
4  *   info_at_agrum_dot_org
5  *
6  *  This library is free software: you can redistribute it and/or modify
7  *  it under the terms of the GNU Lesser General Public License as published by
8  *  the Free Software Foundation, either version 3 of the License, or
9  *  (at your option) any later version.
10  *
11  *  This library is distributed in the hope that it will be useful,
12  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  *  GNU Lesser General Public License for more details.
15  *
16  *  You should have received a copy of the GNU Lesser General Public License
17  *  along with this library.  If not, see <http://www.gnu.org/licenses/>.
18  *
19  */
20 
21 
22 /**
23  * @file
24  * @brief Inline implementation of gum::PRMReferenceSlot
25  *
26  * @author Lionel TORTI and Pierre-Henri WUILLEMIN(_at_LIP6)
27  */
28 #include <agrum/PRM/elements/PRMReferenceSlot.h>
29 
30 namespace gum {
31   namespace prm {
32 
33     template < typename GUM_SCALAR >
PRMReferenceSlot(const std::string & name,PRMClassElementContainer<GUM_SCALAR> & type,bool isArray)34     PRMReferenceSlot< GUM_SCALAR >::PRMReferenceSlot(const std::string&                      name,
35                                                      PRMClassElementContainer< GUM_SCALAR >& type,
36                                                      bool isArray) :
37         PRMClassElement< GUM_SCALAR >(name),
38         _slotType_(type), _isArray_(isArray) {
39       GUM_CONSTRUCTOR(PRMReferenceSlot);
40       this->safeName_ = PRMObject::LEFT_CAST() + type.name() + PRMObject::RIGHT_CAST() + name;
41     }
42 
43     // Destructor.
44     template < typename GUM_SCALAR >
~PRMReferenceSlot()45     PRMReferenceSlot< GUM_SCALAR >::~PRMReferenceSlot() {
46       GUM_DESTRUCTOR(PRMReferenceSlot);
47     }
48 
49     template < typename GUM_SCALAR >
PRMReferenceSlot(const PRMReferenceSlot<GUM_SCALAR> & source)50     PRMReferenceSlot< GUM_SCALAR >::PRMReferenceSlot(const PRMReferenceSlot< GUM_SCALAR >& source) :
51         PRMClassElement< GUM_SCALAR >(source), _slotType_(source._slotType_),
52         _isArray_(source._isArray_) {
53       GUM_CONS_CPY(PRMReferenceSlot);
54       GUM_ERROR(FatalError, "illegal call to gum::ReferenceSlot copy constructor.")
55     }
56 
57     // Copy operator. Raise a FatalError.
58     template < typename GUM_SCALAR >
59     PRMReferenceSlot< GUM_SCALAR >&
60        PRMReferenceSlot< GUM_SCALAR >::operator=(const PRMReferenceSlot< GUM_SCALAR >& from) {
61       GUM_ERROR(FatalError, "illegal call to gum::ReferenceSlot copy operator.")
62     }
63 
64     template < typename GUM_SCALAR >
65     INLINE typename PRMClassElement< GUM_SCALAR >::ClassElementType
elt_type()66        PRMReferenceSlot< GUM_SCALAR >::elt_type() const {
67       return this->prm_refslot;
68     }
69 
70     template < typename GUM_SCALAR >
slotType()71     INLINE PRMClassElementContainer< GUM_SCALAR >& PRMReferenceSlot< GUM_SCALAR >::slotType() {
72       return _slotType_;
73     }
74 
75     template < typename GUM_SCALAR >
76     INLINE const PRMClassElementContainer< GUM_SCALAR >&
slotType()77                  PRMReferenceSlot< GUM_SCALAR >::slotType() const {
78       return _slotType_;
79     }
80 
81     template < typename GUM_SCALAR >
isArray()82     INLINE bool PRMReferenceSlot< GUM_SCALAR >::isArray() const {
83       return _isArray_;
84     }
85 
86     template < typename GUM_SCALAR >
type()87     INLINE PRMType& PRMReferenceSlot< GUM_SCALAR >::type() {
88       GUM_ERROR(OperationNotAllowed, "This is a ReferenceSlot.")
89     }
90 
91     template < typename GUM_SCALAR >
type()92     INLINE const PRMType& PRMReferenceSlot< GUM_SCALAR >::type() const {
93       GUM_ERROR(OperationNotAllowed, "This is a ReferenceSlot.")
94     }
95 
96     template < typename GUM_SCALAR >
cpf()97     INLINE Potential< GUM_SCALAR >& PRMReferenceSlot< GUM_SCALAR >::cpf() {
98       GUM_ERROR(OperationNotAllowed, "This is a ReferenceSlot.")
99     }
100 
101     template < typename GUM_SCALAR >
cpf()102     INLINE const Potential< GUM_SCALAR >& PRMReferenceSlot< GUM_SCALAR >::cpf() const {
103       GUM_ERROR(OperationNotAllowed, "This is a ReferenceSlot.")
104     }
105 
106     template < typename GUM_SCALAR >
getCastDescendant()107     INLINE PRMAttribute< GUM_SCALAR >* PRMReferenceSlot< GUM_SCALAR >::getCastDescendant() const {
108       GUM_ERROR(OperationNotAllowed, "This is a ReferenceSlot.")
109     }
110 
111 
112     template < typename GUM_SCALAR >
113     INLINE void
addParent(const PRMClassElement<GUM_SCALAR> & elt)114        PRMReferenceSlot< GUM_SCALAR >::addParent(const PRMClassElement< GUM_SCALAR >& elt) {}
115 
116     template < typename GUM_SCALAR >
addChild(const PRMClassElement<GUM_SCALAR> & elt)117     INLINE void PRMReferenceSlot< GUM_SCALAR >::addChild(const PRMClassElement< GUM_SCALAR >& elt) {
118     }
119 
120   } /* namespace prm */
121 } /* namespace gum */
122