aGrUM  0.20.3
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. 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 55 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 68 of file PRMObject.h.

68  : char
69  {
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 42 of file PRMObject.cpp.

References gum::prm::ParamScopeData< GUM_SCALAR >::ParamScopeData().

Referenced by isClass(), isInstance(), and isInterface().

42 : _name_(name) { GUM_CONSTRUCTOR(PRMObject); }
const std::string & name() const
Returns the name of this object.
Definition: PRMObject_inl.h:34
std::string _name_
Definition: PRMObject.h:205
PRMObject(const std::string &name)
Constructor.
Definition: PRMObject.cpp:42
+ 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 46 of file PRMObject.cpp.

References gum::prm::ParamScopeData< GUM_SCALAR >::ParamScopeData().

46  : _name_(source._name_) {
47  GUM_CONS_CPY(PRMObject);
48  }
std::string _name_
Definition: PRMObject.h:205
PRMObject(const std::string &name)
Constructor.
Definition: PRMObject.cpp:42
+ Here is the call graph for this function:

◆ PRMObject() [3/3]

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

Move constructor.

Definition at line 52 of file PRMObject.cpp.

References gum::prm::ParamScopeData< GUM_SCALAR >::ParamScopeData().

52  : _name_(std::move(source._name_)) {
53  GUM_CONS_CPY(PRMObject);
54  }
std::string _name_
Definition: PRMObject.h:205
PRMObject(const std::string &name)
Constructor.
Definition: PRMObject.cpp:42
+ Here is the call graph for this function:

◆ ~PRMObject()

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

Destructor.

Definition at line 58 of file PRMObject.cpp.

References gum::prm::ParamScopeData< GUM_SCALAR >::ParamScopeData().

58  {
59  GUM_DESTRUCTOR(PRMObject);
60  ;
61  }
PRMObject(const std::string &name)
Constructor.
Definition: PRMObject.cpp:42
+ Here is the call 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.

83  {
84  switch (type) {
85  case prm_type::CLASS:
86  return "PRMType::CLASS";
87 
89  return "PRMType::CLASS_ELT";
90 
91  case prm_type::TYPE:
92  return "PRMType::TYPE";
93 
94  case prm_type::SYSTEM:
95  return "PRMType::SYSTEM";
96 
97  case prm_type::INSTANCE:
98  return "PRMType::INSTANCE";
99 
101  return "PRMType::PRM_INTERFACE";
102 
103  default:
104  return "unknown";
105  }
106  }

◆ isClass()

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

Returns true if obj_ptr is of type Class.

Definition at line 109 of file PRMObject.h.

References PRMObject().

109 { return obj.obj_type() == prm_type::CLASS; }
+ Here is the call 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 117 of file PRMObject.h.

References PRMObject().

117  {
118  return obj.obj_type() == prm_type::INSTANCE;
119  }
+ 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 112 of file PRMObject.h.

References PRMObject().

112  {
113  return obj.obj_type() == prm_type::PRM_INTERFACE;
114  }
+ 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.

79 { return "("; }

◆ name() [1/2]

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

Returns the name of this object.

Definition at line 34 of file PRMObject_inl.h.

References gum::prm::ParamScopeData< GUM_SCALAR >::ParamScopeData().

34 { return _name_; }
std::string _name_
Definition: PRMObject.h:205
+ Here is the call graph for this function:

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

References gum::prm::ParamScopeData< GUM_SCALAR >::ParamScopeData().

38 { _name_ = name; }
const std::string & name() const
Returns the name of this object.
Definition: PRMObject_inl.h:34
std::string _name_
Definition: PRMObject.h:205
+ 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 46 of file PRMObject_inl.h.

References gum::prm::ParamScopeData< GUM_SCALAR >::ParamScopeData().

46 { return _name_ != obj.name(); }
std::string _name_
Definition: PRMObject.h:205
+ Here is the call 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 gum::prm::ParamScopeData< GUM_SCALAR >::ParamScopeData().

64  {
65  _name_ = source._name_;
66  return *this;
67  }
std::string _name_
Definition: PRMObject.h:205
+ Here is the call 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 gum::prm::ParamScopeData< GUM_SCALAR >::ParamScopeData().

70  {
71  _name_ = std::move(source._name_);
72  return *this;
73  }
std::string _name_
Definition: PRMObject.h:205
+ 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 42 of file PRMObject_inl.h.

References gum::prm::ParamScopeData< GUM_SCALAR >::ParamScopeData().

42 { return _name_ == obj.name(); }
std::string _name_
Definition: PRMObject.h:205
+ Here is the call 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.

80 { return ")"; }

Member Data Documentation

◆ _name_

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

Definition at line 205 of file PRMObject.h.


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