aGrUM  0.20.2
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) {
34  GUM_CONSTRUCTOR(NameGenerator);
35  }
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 38 of file nameGenerator_inl.h.

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

38  :
39  counters__(source.counters__) {
40  GUM_CONS_CPY(NameGenerator);
41  }
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 44 of file nameGenerator_inl.h.

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

44 { GUM_DESTRUCTOR(NameGenerator); }
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 53 of file nameGenerator_inl.h.

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

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

◆ operator=()

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

Affectation operator.

Definition at line 47 of file nameGenerator_inl.h.

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

47  {
48  counters__ = source.counters__;
49  return *this;
50  }
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: