aGrUM  0.20.3
a C++ library for (probabilistic) graphical models
gum::prm::NameGenerator Class Reference

This is a name generator for classes, types, systems, instances and class elements. More...

#include <agrum/PRM/generator/PRMGenerator.h>

Public Member Functions

Constructors and destructor.
 NameGenerator ()
 Default constructor. More...
 
 NameGenerator (const NameGenerator &source)
 Copy constructor. More...
 
virtual ~NameGenerator ()
 Destructor. More...
 
NameGeneratoroperator= (const NameGenerator &source)
 Affectation operator. More...
 
std::string nextName (PRMObject::prm_type type)
 Getters and setters. More...
 

Detailed Description

This is a name generator for classes, types, systems, instances and class elements.

The generation simply use an unsigned int starting at 1 and increasing for each new name. Different numbers are used for each different type of PRMObject.

Definition at line 52 of file nameGenerator.h.

Constructor & Destructor Documentation

◆ NameGenerator() [1/2]

INLINE gum::prm::NameGenerator::NameGenerator ( )

Default constructor.

Definition at line 33 of file nameGenerator_inl.h.

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

33 : _counters_(3, 1) { GUM_CONSTRUCTOR(NameGenerator); }
std::vector< Size > _counters_
The vector of counters.
Definition: nameGenerator.h:80
NameGenerator()
Default constructor.
+ Here is the call graph for this function:

◆ NameGenerator() [2/2]

INLINE gum::prm::NameGenerator::NameGenerator ( const NameGenerator source)

Copy constructor.

Definition at line 35 of file nameGenerator_inl.h.

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

35  :
36  _counters_(source._counters_) {
37  GUM_CONS_CPY(NameGenerator);
38  }
std::vector< Size > _counters_
The vector of counters.
Definition: nameGenerator.h:80
NameGenerator()
Default constructor.
+ Here is the call graph for this function:

◆ ~NameGenerator()

INLINE gum::prm::NameGenerator::~NameGenerator ( )
virtual

Destructor.

Definition at line 40 of file nameGenerator_inl.h.

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

40  {
41  GUM_DESTRUCTOR(NameGenerator);
42  ;
43  }
NameGenerator()
Default constructor.
+ Here is the call graph for this function:

Member Function Documentation

◆ nextName()

INLINE std::string gum::prm::NameGenerator::nextName ( PRMObject::prm_type  type)

Getters and setters.

Returns the next name w.r.t. the given PRMType.

Definition at line 52 of file nameGenerator_inl.h.

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

52  {
53  std::stringstream s;
54 
55  switch (type) {
58  s << "class_" << ++(_counters_[0]);
59  break;
60  }
61 
63  s << "iface_" << ++(_counters_[0]);
64  break;
65  }
66 
68  s << "sys_" << ++(_counters_[0]);
69  break;
70  }
71 
73  s << "type_" << ++(_counters_[0]);
74  break;
75  }
76 
78  s << "elt_" << ++(_counters_[1]);
79  break;
80  }
81 
83  s << "inst_" << ++(_counters_[2]);
84  break;
85  }
86 
87  default: {
88  GUM_ERROR(FatalError, "unknown PRMObject type")
89  }
90  }
91 
92  return s.str();
93  }
std::vector< Size > _counters_
The vector of counters.
Definition: nameGenerator.h:80
#define GUM_ERROR(type, msg)
Definition: exceptions.h:51
+ Here is the call graph for this function:

◆ operator=()

INLINE NameGenerator & gum::prm::NameGenerator::operator= ( const NameGenerator source)

Affectation operator.

Definition at line 46 of file nameGenerator_inl.h.

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

46  {
47  _counters_ = source._counters_;
48  return *this;
49  }
std::vector< Size > _counters_
The vector of counters.
Definition: nameGenerator.h:80
+ Here is the call graph for this function:

Member Data Documentation

◆ _counters_

std::vector< Size > gum::prm::NameGenerator::_counters_
private

The vector of counters.

Definition at line 80 of file nameGenerator.h.


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