Loading...
Searching...
No Matches
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-2025 OpenCFD Ltd.
10-------------------------------------------------------------------------------
11License
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
27Class
28 Foam::simpleObjectRegistry
29
30Description
31 Object registry for simpleRegIOobject. Maintains ordering.
32
33SourceFiles
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_view>
44#include <string>
45
46// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
47
48namespace Foam
49{
50
51// Forward Declarations
52class dictionary;
54/*---------------------------------------------------------------------------*\
55 Class simpleObjectRegistryEntry Declaration
56\*---------------------------------------------------------------------------*/
57
59:
60 public Dictionary<simpleObjectRegistryEntry>::link,
61 public List<simpleRegIOobject*>
62{
63public:
64
65 //- Construct with a single object (list size == 1)
67 :
68 List<simpleRegIOobject*>(Foam::one{}, obj)
69 {}
70
71 //- Construct with a List of objects
72 explicit simpleObjectRegistryEntry(const List<simpleRegIOobject*>& data)
73 :
75 {}
76};
77
78
79/*---------------------------------------------------------------------------*\
80 Class simpleObjectRegistry Declaration
81\*---------------------------------------------------------------------------*/
84:
85 public Dictionary<simpleObjectRegistryEntry>
86{
87public:
88
89 // Constructors
90
91 //- Default construct: empty without allocation (capacity=0).
92 simpleObjectRegistry() = default;
94 //- Construct empty with initial table capacity
95 explicit simpleObjectRegistry(const label initialCapacity)
96 :
98 {}
99
100
101 // Member Functions
102
103 //- Set values (invoke callbacks) from dictionary entries
104 // Reporting honours the infoDetailLevel
105 void setValues
106 (
107 const dictionary& dict,
109 bool verbose = false,
111 bool dryrun = false
112 );
113
114 //- Set named value, but also handle embedded 'name=value' syntax
115 // Treats 'name=' and 'name' identically.
116 // Also accepts a floating point value (and even strings),
117 // but the called objects need to handle those.
118 void setNamedValue
119 (
120 const std::string_view name,
121 int val,
123 bool verbose = false,
125 bool dryrun = false
126 );
127
128 //- Deprecated(2021-09) renamed to setNamedValue
129 // \deprecated(2021-09) renamed to setNamedValue
130 void setNamedInt
131 (
132 const std::string_view name,
133 int val,
134 bool verbose = false
135 )
136 {
137 this->setNamedValue(name, val, verbose);
138 }
139};
140
141
142// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
143
144} // End namespace Foam
145
146// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
147
148#endif
149
150// ************************************************************************* //
General purpose template dictionary class that manages the storage associated with it.
Definition Dictionary.H:51
Dictionary(const label initialCapacity=128)
Definition Dictionary.H:65
simpleRegIOobject ** data() noexcept
Definition UListI.H:274
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition dictionary.H:133
A class representing the concept of 1 (one) that can be used to avoid manipulating objects known to b...
Definition one.H:57
simpleObjectRegistryEntry(const List< simpleRegIOobject * > &data)
Construct with a List of objects.
simpleObjectRegistryEntry(simpleRegIOobject *obj)
Construct with a single object (list size == 1).
simpleObjectRegistry(const label initialCapacity)
Construct empty with initial table capacity.
void setValues(const dictionary &dict, bool verbose=false, bool dryrun=false)
Set values (invoke callbacks) from dictionary entries.
simpleObjectRegistry()=default
Default construct: empty without allocation (capacity=0).
void setNamedInt(const std::string_view name, int val, bool verbose=false)
Deprecated(2021-09) renamed to setNamedValue.
void setNamedValue(const std::string_view name, int val, bool verbose=false, bool dryrun=false)
Set named value, but also handle embedded 'name=value' syntax.
Abstract base class for registered object with I/O. Used in debug symbol registration.
Namespace for OpenFOAM.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
Definition exprTraits.C:127
dictionary dict