aGrUM  0.20.3
a C++ library for (probabilistic) graphical models
nameGenerator.h
Go to the documentation of this file.
1 /**
2  *
3  * Copyright (c) 2005-2021 by Pierre-Henri WUILLEMIN(@LIP6) & Christophe GONZALES(@AMU)
4  * info_at_agrum_dot_org
5  *
6  * This library is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU Lesser General Public License as published by
8  * the Free Software Foundation, either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public License
17  * along with this library. If not, see <http://www.gnu.org/licenses/>.
18  *
19  */
20 
21 
22 /**
23  * @file
24  * @brief Headers of PRMGenerator.
25  *
26  * @author Lionel TORTI and Pierre-Henri WUILLEMIN(@LIP6)
27  */
28 
29 #include <sstream>
30 #include <string>
31 
32 #include <agrum/PRM/elements/PRMObject.h>
33 #include <agrum/agrum.h>
34 
35 #ifndef GUM_NAME_GENERATOR_H
36 # define GUM_NAME_GENERATOR_H
37 namespace gum {
38  namespace prm {
39 
40  /**
41  * @class NameGenerator
42  * @headerfile PRMGenerator.h <agrum/PRM/generator/PRMGenerator.h>
43  * @brief This is a name generator for classes, types, systems, instances
44  *and
45  * class elements.
46  *
47  * The generation simply use an unsigned int starting at 1 and increasing
48  *for
49  * each new name. Different numbers are used for each different type of
50  * PRMObject.
51  */
52  class NameGenerator {
53  public:
54  // ========================================================================
55  /// @name Constructors and destructor.
56  // ========================================================================
57  /// @{
58 
59  /// Default constructor.
60  NameGenerator();
61  /// Copy constructor.
62  NameGenerator(const NameGenerator& source);
63  /// Destructor.
64  virtual ~NameGenerator();
65  /// Affectation operator
66  NameGenerator& operator=(const NameGenerator& source);
67 
68  /// @}
69  // ========================================================================
70  /// Getters and setters.
71  // ========================================================================
72  /// @{
73 
74  /// Returns the next name w.r.t. the given PRMType.
75  std::string nextName(PRMObject::prm_type type);
76 
77  /// @}
78  private:
79  /// The vector of counters.
80  std::vector< Size > _counters_;
81  };
82 
83  } /* namespace prm */
84 } /* namespace gum */
85 
86 # ifndef GUM_NO_INLINE
87 # include <agrum/PRM/generator/nameGenerator_inl.h>
88 # endif
89 
90 #endif /* GUM_NAME_GENERATOR_H */