aGrUM  0.14.2
PRMClassElement_tpl.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  ***************************************************************************/
28 
29 namespace gum {
30  namespace prm {
31 
32  template < typename GUM_SCALAR >
34  PRMObject(name) {
35  GUM_CONSTRUCTOR(PRMClassElement);
36  }
37 
38  template < typename GUM_SCALAR >
40  const PRMClassElement< GUM_SCALAR >& source) :
41  PRMObject(source.name()),
42  __id(source.id()) {
43  GUM_CONS_CPY(PRMClassElement);
44  }
45 
46  template < typename GUM_SCALAR >
48  GUM_DESTRUCTOR(PRMClassElement);
49  }
50 
51  template < typename GUM_SCALAR >
53  return __id;
54  }
55 
56  template < typename GUM_SCALAR >
58  return prm_type::CLASS_ELT;
59  }
60 
61  template < typename GUM_SCALAR >
63  __id = id;
64  }
65 
66  template < typename GUM_SCALAR >
67  INLINE const std::string& PRMClassElement< GUM_SCALAR >::safeName() const {
68  return _safeName;
69  }
70 
71  template < typename GUM_SCALAR >
72  INLINE std::string
74  if (type().isSubTypeOf(t)) {
75  return PRMObject::LEFT_CAST() + t.name() + PRMObject::RIGHT_CAST()
76  + name();
77  } else {
78  GUM_ERROR(OperationNotAllowed, "illegal cast");
79  }
80  }
81 
82  } /* namespace prm */
83 } /* namespace gum */
const std::string & name() const
Returns the name of this object.
Definition: PRMType_inl.h:65
Abstract class representing an element of PRM class.
gum is the global namespace for all aGrUM entities
Definition: agrum.h:25
prm_type
Enumeration of the different types of objects handled by a PRM.
Definition: PRMObject.h:66
This is a decoration of the DiscreteVariable class.
Definition: PRMType.h:60
Headers of Class.
Abstract base class for any element defined in a PRM.
Definition: PRMObject.h:53
Headers of gum::PRMClassElement.
PRMClassElement(const std::string &name)
Default constructor of a PRMClassElement.
Size NodeId
Type for node ids.
Definition: graphElements.h:97
#define GUM_ERROR(type, msg)
Definition: exceptions.h:52