aGrUM  0.16.0
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. More...
 
 PRMObject (const PRMObject &source)
 Copy constructor. More...
 
 PRMObject (PRMObject &&source)
 Move constructor. More...
 
virtual ~PRMObject ()
 Destructor. More...
 
Getters & setters.
const std::string & name () const
 Returns the name of this object. More...
 
void name (const std::string &name)
 Change the name of the PRM Object. More...
 
virtual prm_type obj_type () const =0
 Returns the type of this object. More...
 
Operators
bool operator== (const PRMObject &obj) const
 To PRMObject are equal if they have the same name (which is unique). More...
 
bool operator!= (const PRMObject &obj) const
 To PRMObject are equal if they have the same name (which is unique). More...
 
PRMObjectoperator= (const PRMObject &source)
 Copy operator. More...
 
PRMObjectoperator= (PRMObject &&source)
 Move operator. More...
 

Built-in types.

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

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

Member Enumeration Documentation

◆ prm_type

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

69  : char {
70  ALL,
71  CLASS,
72  PRM_INTERFACE,
73  CLASS_ELT,
74  TYPE,
75  SYSTEM,
76  INSTANCE
77  };

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 43 of file PRMObject.cpp.

Referenced by isInstance().

43  : __name(name) {
44  GUM_CONSTRUCTOR(PRMObject);
45  }
const std::string & name() const
Returns the name of this object.
Definition: PRMObject_inl.h:35
std::string __name
Definition: PRMObject.h:200
PRMObject(const std::string &name)
Constructor.
Definition: PRMObject.cpp:43
+ Here is the caller graph for this function:

◆ PRMObject() [2/3]

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

Copy constructor.

Definition at line 49 of file PRMObject.cpp.

49  : __name(source.__name) {
50  GUM_CONS_CPY(PRMObject);
51  }
std::string __name
Definition: PRMObject.h:200
PRMObject(const std::string &name)
Constructor.
Definition: PRMObject.cpp:43

◆ PRMObject() [3/3]

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

Move constructor.

Definition at line 55 of file PRMObject.cpp.

55  : __name(std::move(source.__name)) {
56  GUM_CONS_CPY(PRMObject);
57  }
std::string __name
Definition: PRMObject.h:200
PRMObject(const std::string &name)
Constructor.
Definition: PRMObject.cpp:43

◆ ~PRMObject()

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

Destructor.

Definition at line 61 of file PRMObject.cpp.

Referenced by isInstance().

61 { GUM_DESTRUCTOR(PRMObject); }
PRMObject(const std::string &name)
Constructor.
Definition: PRMObject.cpp:43
+ Here is the caller graph for this function:

Member Function Documentation

◆ enum2str()

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

Returns the string representation of a PRMObject.

Definition at line 83 of file PRMObject.h.

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

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

83  {
84  switch (type) {
85  case prm_type::CLASS: return "PRMType::CLASS";
86 
87  case prm_type::CLASS_ELT: return "PRMType::CLASS_ELT";
88 
89  case prm_type::TYPE: return "PRMType::TYPE";
90 
91  case prm_type::SYSTEM: return "PRMType::SYSTEM";
92 
93  case prm_type::INSTANCE: return "PRMType::INSTANCE";
94 
95  case prm_type::PRM_INTERFACE: return "PRMType::PRM_INTERFACE";
96 
97  default: return "unknown";
98  }
99  }
+ Here is the caller graph for this function:

◆ isClass()

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

Returns true if obj_ptr is of type Class.

Definition at line 102 of file PRMObject.h.

References CLASS, and obj_type().

Referenced by gum::prm::PRMFactory< GUM_SCALAR >::startAttribute().

102  {
103  return obj.obj_type() == prm_type::CLASS;
104  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isInstance()

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

Returns true if obj_ptr is of type PRMInstance.

Definition at line 112 of file PRMObject.h.

References INSTANCE, name(), obj_type(), operator!=(), operator=(), operator==(), PRMObject(), and ~PRMObject().

112  {
113  return obj.obj_type() == prm_type::INSTANCE;
114  }
+ Here is the call graph for this function:

◆ isInterface()

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

Returns true if obj_ptr is of type PRMInterface.

Definition at line 107 of file PRMObject.h.

References obj_type(), and PRM_INTERFACE.

107  {
108  return obj.obj_type() == prm_type::PRM_INTERFACE;
109  }
+ Here is the call graph for this function:

◆ LEFT_CAST()

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

Referenced by gum::prm::decomposePath(), gum::prm::PRMFormAttribute< GUM_SCALAR >::PRMFormAttribute(), and gum::prm::PRMScalarAttribute< GUM_SCALAR >::PRMScalarAttribute().

79 { return "("; }
+ 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 35 of file PRMObject_inl.h.

References __name.

Referenced by gum::prm::SVE< GUM_SCALAR >::__addDelayedVariable(), gum::prm::PRMClass< double >::__addIOInterfaceFlags(), gum::prm::PRMFactory< GUM_SCALAR >::__addParent(), gum::prm::PRMInstance< GUM_SCALAR >::__addReferingInstance(), gum::prm::PRMClass< double >::__checkInterface(), gum::prm::PRMFactory< GUM_SCALAR >::__checkInterfaceImplementation(), gum::prm::PRMClass< double >::__checkInterfaces(), gum::prm::o3prm::O3ClassFactory< GUM_SCALAR >::__checkRawCPT(), gum::prm::PRMClass< double >::__checkRefInterface(), gum::prm::PRMClass< double >::__checkRefInterfaces(), gum::prm::o3prm::O3ClassFactory< GUM_SCALAR >::__checkRuleCPTSumsTo1(), gum::prm::PRMInstance< GUM_SCALAR >::__copyAggregates(), gum::prm::PRMInstance< GUM_SCALAR >::__copyAttribute(), gum::prm::PRMSlotChain< double >::__copyLastElt(), gum::prm::PRMSystem< double >::__groundAttr(), gum::prm::PRMSystem< double >::__groundPotential(), gum::prm::PRMSystem< double >::__groundRef(), gum::prm::PRMClass< double >::__inheritClass(), gum::prm::PRMInterface< double >::__overloadAttribute(), gum::prm::PRMClass< double >::__overloadAttribute(), gum::prm::PRMClass< double >::__overloadParameter(), gum::prm::PRMClass< double >::__overloadReference(), gum::prm::PRMInterface< double >::__overloadReferenceSlot(), gum::prm::__print_attribute__(), gum::prm::__print_instance__(), gum::prm::gspan::StrictSearch< GUM_SCALAR >::__str(), gum::prm::StructuredInference< GUM_SCALAR >::__str(), gum::prm::PRMInterface< double >::add(), gum::prm::PRMSystem< double >::add(), gum::prm::PRMClass< double >::add(), gum::prm::PRMFactory< GUM_SCALAR >::addAggregator(), gum::prm::PRMFormAttribute< GUM_SCALAR >::addParent(), gum::prm::PRMScalarAttribute< GUM_SCALAR >::addParent(), gum::prm::PRMFormAttribute< GUM_SCALAR >::copy(), gum::prm::PRMScalarAttribute< GUM_SCALAR >::copy(), gum::prm::o3prmr::O3prmrInterpreter::findAttributeName(), gum::prm::o3prmr::O3prmrInterpreter::findInstanceName(), gum::prm::PRMFormAttribute< GUM_SCALAR >::getCastDescendant(), gum::prm::PRMScalarAttribute< GUM_SCALAR >::getCastDescendant(), gum::prm::PRMClass< double >::inheritAggregates(), gum::prm::PRMClass< double >::isCastDescendant(), isInstance(), name(), gum::prm::PRMType::name(), gum::prm::PRMFormAttribute< GUM_SCALAR >::newFactory(), gum::prm::PRMScalarAttribute< GUM_SCALAR >::newFactory(), gum::prm::PRMType::operator!=(), operator!=(), operator<<(), gum::prm::PRMType::operator==(), operator==(), gum::prm::PRMClass< double >::overload(), gum::prm::PRMInterface< double >::overload(), gum::prm::PRMFormAttribute< GUM_SCALAR >::PRMFormAttribute(), gum::prm::PRMReferenceSlot< double >::PRMReferenceSlot(), gum::prm::PRMScalarAttribute< GUM_SCALAR >::PRMScalarAttribute(), gum::prm::PRMFactory< GUM_SCALAR >::startClass(), gum::prm::PRMFactory< GUM_SCALAR >::startInterface(), gum::prm::PRMFactory< GUM_SCALAR >::startSystem(), and gum::prm::PRMAggregate< double >::str2enum().

35 { return __name; }
std::string __name
Definition: PRMObject.h:200

◆ 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 wath you are doing !

Definition at line 39 of file PRMObject_inl.h.

References __name, and name().

39 { __name = name; }
const std::string & name() const
Returns the name of this object.
Definition: PRMObject_inl.h:35
std::string __name
Definition: PRMObject.h:200
+ Here is the call graph for this function:

◆ obj_type()

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

References __name, and name().

Referenced by isInstance().

49  {
50  return __name != obj.name();
51  }
std::string __name
Definition: PRMObject.h:200
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ operator=() [1/2]

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

Copy operator.

Definition at line 64 of file PRMObject.cpp.

References __name.

Referenced by isInstance().

64  {
65  __name = source.__name;
66  return *this;
67  }
std::string __name
Definition: PRMObject.h:200
+ Here is the caller graph for this function:

◆ operator=() [2/2]

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

Move operator.

Definition at line 70 of file PRMObject.cpp.

References __name.

70  {
71  __name = std::move(source.__name);
72  return *this;
73  }
std::string __name
Definition: PRMObject.h:200

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

References __name, and name().

Referenced by isInstance().

43  {
44  return __name == obj.name();
45  }
std::string __name
Definition: PRMObject.h:200
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ RIGHT_CAST()

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

Referenced by gum::prm::decomposePath(), gum::prm::PRMFormAttribute< GUM_SCALAR >::PRMFormAttribute(), and gum::prm::PRMScalarAttribute< GUM_SCALAR >::PRMScalarAttribute().

80 { return ")"; }
+ Here is the caller graph for this function:

Member Data Documentation

◆ __name

std::string gum::prm::PRMObject::__name
private

Definition at line 200 of file PRMObject.h.

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


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