aGrUM
3.2.0
a C++ library for (probabilistic) graphical models
Toggle main menu visibility
PRMObject_inl.h
Go to the documentation of this file.
1
/****************************************************************************
2
* This file is part of the aGrUM/pyAgrum library. *
3
* *
4
* Copyright (c) 2005-2026 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-2026 *
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
#pragma once
42
49
50
#include <
agrum/PRM/elements/PRMObject.h
>
// to ease IDE parser
51
52
namespace
gum
{
53
namespace
prm
{
54
55
// Returns the name of this object.
56
INLINE
57
const
std::string&
PRMObject::name
()
const
{
return
_name_
; }
58
59
// Returns the name of this object.
60
INLINE
61
void
PRMObject::name
(std::string_view
name
) {
_name_
=
name
; }
62
63
// To PRMObject are equal if they have the same name (which is unique).
64
INLINE
65
bool
PRMObject::operator==
(
const
PRMObject
& obj)
const
{
return
_name_
== obj.
name
(); }
66
67
// To PRMObject are equal if they have the same name (which is unique).
68
INLINE
69
bool
PRMObject::operator!=
(
const
PRMObject
& obj)
const
{
return
_name_
!= obj.
name
(); }
70
71
INLINE std::string
PRMObject::LEFT_CAST
() {
return
"("
; }
72
73
INLINE std::string
PRMObject::RIGHT_CAST
() {
return
")"
; }
74
75
INLINE std::string
PRMObject::enum2str
(
prm_type
type) {
76
switch
(type) {
77
case
prm_type::CLASS
:
return
"PRMType::CLASS"
;
78
79
case
prm_type::CLASS_ELT
:
return
"PRMType::CLASS_ELT"
;
80
81
case
prm_type::TYPE
:
return
"PRMType::TYPE"
;
82
83
case
prm_type::SYSTEM
:
return
"PRMType::SYSTEM"
;
84
85
case
prm_type::INSTANCE
:
return
"PRMType::INSTANCE"
;
86
87
case
prm_type::PRM_INTERFACE
:
return
"PRMType::PRM_INTERFACE"
;
88
89
default :
return
"unknown"
;
90
}
91
}
92
93
INLINE
bool
PRMObject::isClass
(
const
PRMObject
& obj) {
94
return
obj.
obj_type
() ==
prm_type::CLASS
;
95
}
96
97
INLINE
bool
PRMObject::isInterface
(
const
PRMObject
& obj) {
98
return
obj.
obj_type
() ==
prm_type::PRM_INTERFACE
;
99
}
100
101
INLINE
bool
PRMObject::isInstance
(
const
PRMObject
& obj) {
102
return
obj.
obj_type
() ==
prm_type::INSTANCE
;
103
}
104
105
}
/* namespace prm */
106
}
/* namespace gum */
PRMObject.h
Headers of PRMObject.
gum::prm::PRMObject::PRMObject
PRMObject(std::string_view name)
Constructor.
Definition
PRMObject.cpp:62
gum::prm::PRMObject::name
const std::string & name() const
Returns the name of this object.
Definition
PRMObject_inl.h:57
gum::prm::PRMObject::operator==
bool operator==(const PRMObject &obj) const
To PRMObject are equal if they have the same name (which is unique).
Definition
PRMObject_inl.h:65
gum::prm::PRMObject::prm_type
prm_type
Enumeration of the different types of objects handled by a PRM.
Definition
PRMObject.h:90
gum::prm::PRMObject::prm_type::CLASS_ELT
@ CLASS_ELT
Definition
PRMObject.h:90
gum::prm::PRMObject::prm_type::INSTANCE
@ INSTANCE
Definition
PRMObject.h:90
gum::prm::PRMObject::prm_type::TYPE
@ TYPE
Definition
PRMObject.h:90
gum::prm::PRMObject::prm_type::PRM_INTERFACE
@ PRM_INTERFACE
Definition
PRMObject.h:90
gum::prm::PRMObject::prm_type::CLASS
@ CLASS
Definition
PRMObject.h:90
gum::prm::PRMObject::prm_type::SYSTEM
@ SYSTEM
Definition
PRMObject.h:90
gum::prm::PRMObject::operator!=
bool operator!=(const PRMObject &obj) const
To PRMObject are equal if they have the same name (which is unique).
Definition
PRMObject_inl.h:69
gum::prm::PRMObject::_name_
std::string _name_
Definition
PRMObject.h:193
gum::prm::PRMObject::RIGHT_CAST
static std::string RIGHT_CAST()
Enumeration of the different types of objects handled by a PRM.
Definition
PRMObject_inl.h:73
gum::prm::PRMObject::isClass
static INLINE bool isClass(const PRMObject &obj)
Returns true if obj_ptr is of type Class.
Definition
PRMObject_inl.h:93
gum::prm::PRMObject::LEFT_CAST
static std::string LEFT_CAST()
Enumeration of the different types of objects handled by a PRM.
Definition
PRMObject_inl.h:71
gum::prm::PRMObject::obj_type
virtual prm_type obj_type() const =0
Returns the type of this object.
gum::prm::PRMObject::isInstance
static INLINE bool isInstance(const PRMObject &obj)
Returns true if obj_ptr is of type PRMInstance.
Definition
PRMObject_inl.h:101
gum::prm::PRMObject::isInterface
static INLINE bool isInterface(const PRMObject &obj)
Returns true if obj_ptr is of type PRMInterface.
Definition
PRMObject_inl.h:97
gum::prm::PRMObject::enum2str
static std::string enum2str(prm_type type)
Returns the string representation of a PRMObject.
Definition
PRMObject_inl.h:75
gum::prm
namespace for all probabilistic relational models entities
Definition
agrum.h:68
gum
gum is the global namespace for all aGrUM entities
Definition
agrum.h:46
aGrUM
3.2.0
© PHW&CG&others - 2022
DoXyGeN 1.18.0