simpleObjectRegistry.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2012-2016 OpenFOAM Foundation
9  Copyright (C) 2019-2023 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 Class
28  Foam::simpleObjectRegistry
29 
30 Description
31  Object registry for simpleRegIOobject. Maintains ordering.
32 
33 SourceFiles
34  simpleObjectRegistry.C
35 
36 \*---------------------------------------------------------------------------*/
37 
38 #ifndef Foam_simpleObjectRegistry_H
39 #define Foam_simpleObjectRegistry_H
40 
41 #include "Dictionary.H"
42 #include "simpleRegIOobject.H"
43 #include <string>
44 
45 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
46 
47 namespace Foam
48 {
49 
50 // Forward Declarations
51 class dictionary;
52 
53 /*---------------------------------------------------------------------------*\
54  Class simpleObjectRegistryEntry Declaration
55 \*---------------------------------------------------------------------------*/
56 
58 :
59  public Dictionary<simpleObjectRegistryEntry>::link,
60  public List<simpleRegIOobject*>
61 {
62 public:
63 
64  //- Construct with a single object (list size == 1)
66  :
67  List<simpleRegIOobject*>(Foam::one{}, obj)
68  {}
69 
70  //- Construct with a List of objects
72  :
74  {}
75 };
76 
77 
78 /*---------------------------------------------------------------------------*\
79  Class simpleObjectRegistry Declaration
80 \*---------------------------------------------------------------------------*/
81 
83 :
84  public Dictionary<simpleObjectRegistryEntry>
85 {
86 public:
87 
88  // Constructors
89 
90  //- Default construct: empty without allocation (capacity=0).
91  simpleObjectRegistry() = default;
92 
93  //- Construct empty with initial table capacity
94  explicit simpleObjectRegistry(const label initialCapacity)
95  :
97  {}
98 
99 
100  // Member Functions
101 
102  //- Set values (invoke callbacks) from dictionary entries
103  // Reporting honours the infoDetailLevel
104  void setValues(const dictionary& dict, bool report=false);
105 
106  //- Set named value, but also handle embedded 'name=value' syntax
107  // Treats 'name=' and 'name' identically.
108  //
109  // Will also accept a floating point value, but the called objects
110  // need to handle that.
111  // Reporting honours the infoDetailLevel
112  void setNamedValue(std::string name, int val, bool report=false);
113 
114  //- Deprecated(2021-09) renamed to setNamedValue
115  // \deprecated(2021-09) renamed to setNamedValue
116  void setNamedInt(std::string name, int val, bool report=false)
117  {
118  this->setNamedValue(name, val, report);
119  }
120 };
121 
122 
123 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
124 
125 } // End namespace Foam
126 
127 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
129 #endif
130 
131 // ************************************************************************* //
Abstract base class for registered object with I/O. Used in debug symbol registration.
void setNamedInt(std::string name, int val, bool report=false)
Deprecated(2021-09) renamed to setNamedValue.
dictionary dict
void setNamedValue(std::string name, int val, bool report=false)
Set named value, but also handle embedded &#39;name=value&#39; syntax.
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:129
simpleObjectRegistryEntry(simpleRegIOobject *obj)
Construct with a single object (list size == 1)
simpleObjectRegistry()=default
Default construct: empty without allocation (capacity=0).
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition: BitOps.H:56
T * data() noexcept
Return pointer to the underlying array serving as data storage.
Definition: UListI.H:272
void setValues(const dictionary &dict, bool report=false)
Set values (invoke callbacks) from dictionary entries.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
Definition: exprTraits.C:127
Object registry for simpleRegIOobject. Maintains ordering.
General purpose template dictionary class that manages the storage associated with it...
Definition: Dictionary.H:48
Namespace for OpenFOAM.
A class representing the concept of 1 (one) that can be used to avoid manipulating objects known to b...
Definition: one.H:56