aGrUM 3.0.0
a C++ library for (probabilistic) graphical models
gum::prm::PRMObject Class Referenceabstract

Abstract base class for any element defined in a PRM. More...

#include <PRMObject.h>

Inheritance diagram for gum::prm::PRMObject:

Public Member Functions

Constructor & destructor.
 PRMObject (std::string_view name)
 Constructor.
 PRMObject (const PRMObject &source)
 Copy constructor.
 PRMObject (PRMObject &&source)
 Move constructor.
virtual ~PRMObject ()
 Destructor.
Getters & setters.
const std::string & name () const
 Returns the name of this object.
void name (std::string_view name)
 Change the name of the PRM Object.
virtual prm_type obj_type () const =0
 Returns the type of this object.
Operators
bool operator== (const PRMObject &obj) const
 To PRMObject are equal if they have the same name (which is unique).
bool operator!= (const PRMObject &obj) const
 To PRMObject are equal if they have the same name (which is unique).
PRMObjectoperator= (const PRMObject &source)
 Copy operator.
PRMObjectoperator= (PRMObject &&source)
 Move operator.

Private Attributes

Private members.
std::string _name_

Built-in types.

enum class  prm_type : char {
  ALL , CLASS , PRM_INTERFACE , CLASS_ELT ,
  TYPE , SYSTEM , INSTANCE
}
 Enumeration of the different types of objects handled by a PRM. More...
static std::string LEFT_CAST ()
 Enumeration of the different types of objects handled by a PRM.
static std::string RIGHT_CAST ()
 Enumeration of the different types of objects handled by a PRM.
static std::string enum2str (prm_type type)
 Returns the string representation of a PRMObject.
static INLINE bool isClass (const PRMObject &obj)
 Returns true if obj_ptr is of type Class.
static INLINE bool isInterface (const PRMObject &obj)
 Returns true if obj_ptr is of type PRMInterface.
static INLINE bool isInstance (const PRMObject &obj)
 Returns true if obj_ptr is of type PRMInstance.

Detailed Description

Abstract base class for any element defined in a PRM.

This class is a base class for any element defined in a PRM. Since objects in a PRM are differentiated by their names, the only information we need about them is their name.

Furthermore we use an enumeration to know the concrete type of a given PRMObject preventing faster type checking.

Definition at line 77 of file PRMObject.h.

Member Enumeration Documentation

◆ prm_type

enum class gum::prm::PRMObject::prm_type : char
strong

Enumeration of the different types of objects handled by a PRM.

The "all" type is used to tell that we want any kind of PRMType (useful with iterators for example). No PRMObject will ever have "all" as type.

Enumerator
ALL 
CLASS 
PRM_INTERFACE 
CLASS_ELT 
TYPE 
SYSTEM 
INSTANCE 

Definition at line 90 of file PRMObject.h.

90: char { ALL, CLASS, PRM_INTERFACE, CLASS_ELT, TYPE, SYSTEM, INSTANCE };

Constructor & Destructor Documentation

◆ PRMObject() [1/3]

gum::prm::PRMObject::PRMObject ( std::string_view name)
explicit

Constructor.

Parameters
nameThe name of this object.

Definition at line 62 of file PRMObject.cpp.

62: _name_(name) { GUM_CONSTRUCTOR(PRMObject); }
PRMObject(std::string_view name)
Constructor.
Definition PRMObject.cpp:62
const std::string & name() const
Returns the name of this object.
std::string _name_
Definition PRMObject.h:193

References PRMObject(), _name_, and name().

Referenced by gum::prm::PRMClassElement< GUM_SCALAR >::PRMClassElement(), gum::prm::PRMClassElement< GUM_SCALAR >::PRMClassElement(), gum::prm::PRMClassElementContainer< GUM_SCALAR >::PRMClassElementContainer(), gum::prm::PRMClassElementContainer< GUM_SCALAR >::PRMClassElementContainer(), gum::prm::PRMInstance< GUM_SCALAR >::PRMInstance(), gum::prm::PRMInstance< GUM_SCALAR >::PRMInstance(), PRMObject(), PRMObject(), PRMObject(), gum::prm::PRMSystem< GUM_SCALAR >::PRMSystem(), gum::prm::PRMSystem< GUM_SCALAR >::PRMSystem(), gum::prm::PRMType::PRMType(), gum::prm::PRMType::PRMType(), gum::prm::PRMType::PRMType(), gum::prm::PRMType::PRMType(), ~PRMObject(), gum::prm::PRMSystem< double >::enum2str(), isClass(), isInstance(), obj_type(), operator!=(), operator=(), operator=(), operator==(), gum::prm::PRMType::operator==(), and gum::prm::PRMType::PRMFactory.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ PRMObject() [2/3]

gum::prm::PRMObject::PRMObject ( const PRMObject & source)

Copy constructor.

Definition at line 67 of file PRMObject.cpp.

67 : _name_(source._name_) {
68 GUM_CONS_CPY(PRMObject);
69 }

References PRMObject(), and _name_.

Here is the call graph for this function:

◆ PRMObject() [3/3]

gum::prm::PRMObject::PRMObject ( PRMObject && source)

Move constructor.

Definition at line 74 of file PRMObject.cpp.

74 : _name_(std::move(source._name_)) {
75 GUM_CONS_CPY(PRMObject);
76 }

References PRMObject(), and _name_.

Here is the call graph for this function:

◆ ~PRMObject()

gum::prm::PRMObject::~PRMObject ( )
virtual

Destructor.

Definition at line 81 of file PRMObject.cpp.

81 {
82 GUM_DESTRUCTOR(PRMObject);
83 ;
84 }

References PRMObject().

Here is the call graph for this function:

Member Function Documentation

◆ enum2str()

INLINE std::string gum::prm::PRMObject::enum2str ( prm_type type)
static

Returns the string representation of a PRMObject.

Definition at line 75 of file PRMObject_inl.h.

75 {
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 }

References CLASS, CLASS_ELT, INSTANCE, PRM_INTERFACE, SYSTEM, and TYPE.

Referenced by gum::prm::operator<<().

Here is the caller graph for this function:

◆ isClass()

INLINE bool gum::prm::PRMObject::isClass ( const PRMObject & obj)
static

Returns true if obj_ptr is of type Class.

Definition at line 93 of file PRMObject_inl.h.

93 {
94 return obj.obj_type() == prm_type::CLASS;
95 }

References PRMObject().

Referenced by gum::prm::PRMClass< GUM_SCALAR >::scope(), and gum::prm::PRMFactory< GUM_SCALAR >::startAttribute().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ isInstance()

INLINE bool gum::prm::PRMObject::isInstance ( const PRMObject & obj)
static

Returns true if obj_ptr is of type PRMInstance.

Definition at line 101 of file PRMObject_inl.h.

101 {
102 return obj.obj_type() == prm_type::INSTANCE;
103 }

References PRMObject(), INSTANCE, and obj_type().

Here is the call graph for this function:

◆ isInterface()

INLINE bool gum::prm::PRMObject::isInterface ( const PRMObject & obj)
static

Returns true if obj_ptr is of type PRMInterface.

Definition at line 97 of file PRMObject_inl.h.

97 {
98 return obj.obj_type() == prm_type::PRM_INTERFACE;
99 }

◆ LEFT_CAST()

INLINE std::string gum::prm::PRMObject::LEFT_CAST ( )
static

Enumeration of the different types of objects handled by a PRM.

The "all" type is used to tell that we want any kind of PRMType (useful with iterators for example). No PRMObject will ever have "all" as type.

Definition at line 71 of file PRMObject_inl.h.

71{ return "("; }

Referenced by gum::prm::PRMAggregate< GUM_SCALAR >::PRMAggregate(), gum::prm::PRMAggregate< GUM_SCALAR >::PRMAggregate(), gum::prm::PRMFormAttribute< GUM_SCALAR >::PRMFormAttribute(), gum::prm::PRMReferenceSlot< GUM_SCALAR >::PRMReferenceSlot(), gum::prm::PRMScalarAttribute< GUM_SCALAR >::PRMScalarAttribute(), gum::prm::PRMSlotChain< GUM_SCALAR >::PRMSlotChain(), gum::prm::PRMClassElement< GUM_SCALAR >::cast(), and gum::prm::decomposePath().

Here is the caller graph for this function:

◆ name() [1/2]

INLINE const std::string & gum::prm::PRMObject::name ( ) const

Returns the name of this object.

Definition at line 57 of file PRMObject_inl.h.

57{ return _name_; }

References _name_.

Referenced by gum::prm::PRMAggregate< GUM_SCALAR >::PRMAggregate(), gum::prm::PRMAggregate< GUM_SCALAR >::PRMAggregate(), gum::prm::PRMAttribute< GUM_SCALAR >::PRMAttribute(), gum::prm::PRMClass< GUM_SCALAR >::PRMClass(), gum::prm::PRMClass< GUM_SCALAR >::PRMClass(), gum::prm::PRMClass< GUM_SCALAR >::PRMClass(), gum::prm::PRMClass< GUM_SCALAR >::PRMClass(), gum::prm::PRMClassElement< GUM_SCALAR >::PRMClassElement(), gum::prm::PRMClassElement< GUM_SCALAR >::PRMClassElement(), gum::prm::PRMClassElementContainer< GUM_SCALAR >::PRMClassElementContainer(), gum::prm::PRMFormAttribute< GUM_SCALAR >::PRMFormAttribute(), gum::prm::PRMFormAttribute< GUM_SCALAR >::PRMFormAttribute(), gum::prm::PRMFuncAttribute< GUM_SCALAR >::PRMFuncAttribute(), gum::prm::PRMInstance< GUM_SCALAR >::PRMInstance(), gum::prm::PRMInterface< GUM_SCALAR >::PRMInterface(), gum::prm::PRMInterface< GUM_SCALAR >::PRMInterface(), gum::prm::PRMInterface< GUM_SCALAR >::PRMInterface(), PRMObject(), gum::prm::PRMParameter< GUM_SCALAR >::PRMParameter(), gum::prm::PRMParameter< GUM_SCALAR >::PRMParameter(), gum::prm::PRMReferenceSlot< GUM_SCALAR >::PRMReferenceSlot(), gum::prm::PRMScalarAttribute< GUM_SCALAR >::PRMScalarAttribute(), gum::prm::PRMSlotChain< GUM_SCALAR >::PRMSlotChain(), gum::prm::PRMSlotChain< GUM_SCALAR >::PRMSlotChain(), gum::prm::PRMSlotChain< GUM_SCALAR >::PRMSlotChain(), gum::prm::PRMSystem< GUM_SCALAR >::PRMSystem(), gum::prm::__print_attribute__(), gum::prm::__print_instance__(), gum::prm::SVE< GUM_SCALAR >::_addDelayedVariable_(), gum::prm::PRMClass< GUM_SCALAR >::_addIOInterfaceFlags_(), gum::prm::PRMFactory< GUM_SCALAR >::_addParent_(), gum::prm::PRMInstance< GUM_SCALAR >::_addReferingInstance_(), gum::prm::PRMClass< GUM_SCALAR >::_checkInterface_(), gum::prm::PRMFactory< GUM_SCALAR >::_checkInterfaceImplementation_(), gum::prm::PRMClass< GUM_SCALAR >::_checkInterfaces_(), gum::prm::o3prm::O3ClassFactory< GUM_SCALAR >::_checkRawCPT_(), gum::prm::PRMClass< GUM_SCALAR >::_checkRefInterface_(), gum::prm::PRMClass< GUM_SCALAR >::_checkRefInterfaces_(), gum::prm::o3prm::O3ClassFactory< GUM_SCALAR >::_checkRuleCPTSumsTo1_(), gum::prm::PRMInstance< GUM_SCALAR >::_copyAggregates_(), gum::prm::PRMInstance< GUM_SCALAR >::_copyAttribute_(), gum::prm::PRMSlotChain< GUM_SCALAR >::_copyLastElt_(), gum::prm::PRMSystem< GUM_SCALAR >::_groundAgg_(), gum::prm::PRMSystem< GUM_SCALAR >::_groundRef_(), gum::prm::PRMSystem< GUM_SCALAR >::_groundTensor_(), gum::prm::PRMSystem< double >::_groundTensor_(), gum::prm::PRMClass< GUM_SCALAR >::_inheritClass_(), gum::prm::PRMClass< GUM_SCALAR >::_overloadAttribute_(), gum::prm::PRMInterface< GUM_SCALAR >::_overloadAttribute_(), gum::prm::PRMClass< GUM_SCALAR >::_overloadParameter_(), gum::prm::PRMClass< GUM_SCALAR >::_overloadReference_(), gum::prm::PRMInterface< GUM_SCALAR >::_overloadReferenceSlot_(), gum::prm::gspan::StrictSearch< GUM_SCALAR >::_str_(), gum::prm::gspan::StrictSearch< GUM_SCALAR >::_str_(), gum::prm::gspan::StrictSearch< GUM_SCALAR >::_str_(), gum::prm::StructuredInference< GUM_SCALAR >::_str_(), gum::prm::StructuredInference< GUM_SCALAR >::_str_(), gum::prm::StructuredInference< GUM_SCALAR >::_str_(), gum::prm::PRMClass< GUM_SCALAR >::add(), gum::prm::PRMInterface< GUM_SCALAR >::add(), gum::prm::PRMSystem< GUM_SCALAR >::add(), gum::prm::PRMFactory< GUM_SCALAR >::addAggregator(), gum::prm::PRMFormAttribute< GUM_SCALAR >::addParent(), gum::prm::PRMScalarAttribute< GUM_SCALAR >::addParent(), gum::prm::PRMClassElement< GUM_SCALAR >::cast(), gum::prm::PRMClass< GUM_SCALAR >::completeInheritance(), gum::prm::PRMFormAttribute< GUM_SCALAR >::copy(), gum::prm::PRMScalarAttribute< GUM_SCALAR >::copy(), gum::prm::PRMClassElementContainer< GUM_SCALAR >::exists(), gum::prm::PRMInstance< GUM_SCALAR >::exists(), gum::prm::PRMSystem< GUM_SCALAR >::exists(), gum::prm::o3prmr::O3prmrInterpreter::findAttributeName(), gum::prm::o3prmr::O3prmrInterpreter::findInstanceName(), gum::prm::PRMClass< GUM_SCALAR >::get(), gum::prm::PRMClass< GUM_SCALAR >::get(), gum::prm::PRMClassElementContainer< GUM_SCALAR >::get(), gum::prm::PRMClassElementContainer< GUM_SCALAR >::get(), gum::prm::PRMInstance< GUM_SCALAR >::get(), gum::prm::PRMInstance< GUM_SCALAR >::get(), gum::prm::PRMInterface< GUM_SCALAR >::get(), gum::prm::PRMInterface< GUM_SCALAR >::get(), gum::prm::PRMSystem< GUM_SCALAR >::get(), gum::prm::PRMSystem< GUM_SCALAR >::get(), gum::prm::PRMSystem< GUM_SCALAR >::getArray(), gum::prm::PRMSystem< GUM_SCALAR >::getArrayType(), gum::prm::PRMSystem< GUM_SCALAR >::getArrayType(), gum::prm::PRMAggregate< GUM_SCALAR >::getCastDescendant(), gum::prm::PRMFormAttribute< GUM_SCALAR >::getCastDescendant(), gum::prm::PRMScalarAttribute< GUM_SCALAR >::getCastDescendant(), gum::prm::PRMSystem< GUM_SCALAR >::groundedBN(), gum::prm::PRMClass< GUM_SCALAR >::inheritAggregates(), gum::prm::PRMSystem< GUM_SCALAR >::isArray(), gum::prm::PRMClass< GUM_SCALAR >::isCastDescendant(), gum::prm::PRMSystem< GUM_SCALAR >::isInstance(), name(), gum::prm::PRMType::name(), gum::prm::PRMFormAttribute< GUM_SCALAR >::newFactory(), gum::prm::PRMScalarAttribute< GUM_SCALAR >::newFactory(), operator!=(), operator<<(), gum::prm::PRMClass< GUM_SCALAR >::operator=(), operator==(), gum::prm::PRMType::operator==(), gum::prm::PRMClass< GUM_SCALAR >::operator[](), gum::prm::PRMClass< GUM_SCALAR >::operator[](), gum::prm::PRMClassElementContainer< GUM_SCALAR >::operator[](), gum::prm::PRMClassElementContainer< GUM_SCALAR >::operator[](), gum::prm::PRMInterface< GUM_SCALAR >::operator[](), gum::prm::PRMInterface< GUM_SCALAR >::operator[](), gum::prm::PRMClass< GUM_SCALAR >::overload(), gum::prm::PRMInterface< GUM_SCALAR >::overload(), gum::prm::PRMClassElementContainer< GUM_SCALAR >::PRMClassElementContainterConstIterator, gum::prm::PRMFormAttribute< GUM_SCALAR >::setAsCastDescendant(), gum::prm::PRMScalarAttribute< GUM_SCALAR >::setAsCastDescendant(), gum::prm::PRMClassElementContainer< GUM_SCALAR >::setInputNode(), gum::prm::PRMClassElementContainer< GUM_SCALAR >::setOutputNode(), gum::prm::PRMFactory< GUM_SCALAR >::startClass(), gum::prm::PRMFactory< GUM_SCALAR >::startInterface(), and gum::prm::PRMFactory< GUM_SCALAR >::startSystem().

◆ name() [2/2]

INLINE void gum::prm::PRMObject::name ( std::string_view name)

Change the name of the PRM Object.

Warning
Don't do this unless you know what you are doing !

Definition at line 61 of file PRMObject_inl.h.

61{ _name_ = name; }

References _name_, and name().

Here is the call graph for this function:

◆ obj_type()

virtual prm_type gum::prm::PRMObject::obj_type ( ) const
pure virtual

Returns the type of this object.

Implemented in gum::prm::PRMClass< GUM_SCALAR >, gum::prm::PRMClassElement< GUM_SCALAR >, gum::prm::PRMInstance< GUM_SCALAR >, gum::prm::PRMInterface< GUM_SCALAR >, gum::prm::PRMSystem< GUM_SCALAR >, gum::prm::PRMSystem< double >, and gum::prm::PRMType.

References PRMObject().

Referenced by gum::prm::PRMFactory< GUM_SCALAR >::_checkStack_(), gum::prm::PRMFactory< GUM_SCALAR >::_checkStackContainter_(), gum::prm::PRMSystem< double >::enum2str(), isInstance(), gum::prm::PRMClass< GUM_SCALAR >::isSubTypeOf(), and gum::prm::PRMInterface< GUM_SCALAR >::isSubTypeOf().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ operator!=()

INLINE bool gum::prm::PRMObject::operator!= ( const PRMObject & obj) const

To PRMObject are equal if they have the same name (which is unique).

Definition at line 69 of file PRMObject_inl.h.

69{ return _name_ != obj.name(); }

References PRMObject(), _name_, and name().

Here is the call graph for this function:

◆ operator=() [1/2]

PRMObject & gum::prm::PRMObject::operator= ( const PRMObject & source)
default

Copy operator.

References PRMObject().

Here is the call graph for this function:

◆ operator=() [2/2]

PRMObject & gum::prm::PRMObject::operator= ( PRMObject && source)

Move operator.

Definition at line 90 of file PRMObject.cpp.

90 {
91 _name_ = std::move(source._name_);
92 return *this;
93 }

References PRMObject(), and _name_.

Here is the call graph for this function:

◆ operator==()

INLINE bool gum::prm::PRMObject::operator== ( const PRMObject & obj) const

To PRMObject are equal if they have the same name (which is unique).

Definition at line 65 of file PRMObject_inl.h.

65{ return _name_ == obj.name(); }

References PRMObject(), _name_, and name().

Here is the call graph for this function:

◆ RIGHT_CAST()

INLINE std::string gum::prm::PRMObject::RIGHT_CAST ( )
static

Enumeration of the different types of objects handled by a PRM.

The "all" type is used to tell that we want any kind of PRMType (useful with iterators for example). No PRMObject will ever have "all" as type.

Definition at line 73 of file PRMObject_inl.h.

73{ return ")"; }

Referenced by gum::prm::PRMAggregate< GUM_SCALAR >::PRMAggregate(), gum::prm::PRMAggregate< GUM_SCALAR >::PRMAggregate(), gum::prm::PRMFormAttribute< GUM_SCALAR >::PRMFormAttribute(), gum::prm::PRMReferenceSlot< GUM_SCALAR >::PRMReferenceSlot(), gum::prm::PRMScalarAttribute< GUM_SCALAR >::PRMScalarAttribute(), gum::prm::PRMSlotChain< GUM_SCALAR >::PRMSlotChain(), gum::prm::PRMClassElement< GUM_SCALAR >::cast(), and gum::prm::decomposePath().

Here is the caller graph for this function:

Member Data Documentation

◆ _name_

std::string gum::prm::PRMObject::_name_
private

Definition at line 193 of file PRMObject.h.

Referenced by PRMObject(), PRMObject(), PRMObject(), name(), name(), operator!=(), operator=(), and operator==().


The documentation for this class was generated from the following files: