aGrUM 2.3.2
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 (const std::string &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 (const std::string &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 75 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 88 of file PRMObject.h.

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

Constructor & Destructor Documentation

◆ PRMObject() [1/3]

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

Constructor.

Parameters
nameThe name of this object.

Definition at line 62 of file PRMObject.cpp.

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

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(), 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::PRMInstance< double >::add(), isClass(), isInstance(), isInterface(), obj_type(), operator!=(), gum::prm::PRMType::operator!=(), operator=(), operator=(), operator==(), and gum::prm::PRMType::operator==().

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()

std::string gum::prm::PRMObject::enum2str ( prm_type type)
inlinestatic

Returns the string representation of a PRMObject.

Definition at line 95 of file PRMObject.h.

95 {
96 switch (type) {
97 case prm_type::CLASS : return "PRMType::CLASS";
98
99 case prm_type::CLASS_ELT : return "PRMType::CLASS_ELT";
100
101 case prm_type::TYPE : return "PRMType::TYPE";
102
103 case prm_type::SYSTEM : return "PRMType::SYSTEM";
104
105 case prm_type::INSTANCE : return "PRMType::INSTANCE";
106
107 case prm_type::PRM_INTERFACE : return "PRMType::PRM_INTERFACE";
108
109 default : return "unknown";
110 }
111 }

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)
inlinestatic

Returns true if obj_ptr is of type Class.

Definition at line 114 of file PRMObject.h.

114{ return obj.obj_type() == prm_type::CLASS; }

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

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)
inlinestatic

Returns true if obj_ptr is of type PRMInstance.

Definition at line 122 of file PRMObject.h.

122 {
123 return obj.obj_type() == prm_type::INSTANCE;
124 }

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

Here is the call graph for this function:

◆ isInterface()

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

Returns true if obj_ptr is of type PRMInterface.

Definition at line 117 of file PRMObject.h.

117 {
118 return obj.obj_type() == prm_type::PRM_INTERFACE;
119 }

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

Here is the call graph for this function:

◆ LEFT_CAST()

std::string gum::prm::PRMObject::LEFT_CAST ( )
inlinestatic

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 90 of file PRMObject.h.

90{ 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 54 of file PRMObject_inl.h.

54{ 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::PRMSlotChain< double >::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::PRMSystem< GUM_SCALAR >::_groundAgg_(), gum::prm::PRMSystem< double >::_groundAgg_(), gum::prm::PRMSystem< GUM_SCALAR >::_groundRef_(), gum::prm::PRMSystem< double >::_groundTensor_(), gum::prm::PRMClass< 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::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< double >::instantiate(), 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!=(), 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::PRMClass< GUM_SCALAR >::overload(), gum::prm::PRMInterface< GUM_SCALAR >::overload(), gum::prm::PRMClassElementContainer< GUM_SCALAR >::PRMClassElementContainterConstIterator, 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 ( const std::string & name)

Change the name of the PRM Object.

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

Definition at line 58 of file PRMObject_inl.h.

58{ _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

◆ 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 66 of file PRMObject_inl.h.

66{ 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)

Copy operator.

Definition at line 87 of file PRMObject.cpp.

87 {
88 _name_ = source._name_;
89 return *this;
90 }

References PRMObject(), and _name_.

Here is the call graph for this function:

◆ operator=() [2/2]

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

Move operator.

Definition at line 93 of file PRMObject.cpp.

93 {
94 _name_ = std::move(source._name_);
95 return *this;
96 }

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 62 of file PRMObject_inl.h.

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

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

Here is the call graph for this function:

◆ RIGHT_CAST()

std::string gum::prm::PRMObject::RIGHT_CAST ( )
inlinestatic

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 92 of file PRMObject.h.

92{ 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

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