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-2021 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 simpleObjectRegistry_H
39 #define 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  //- Construct with given or default (128) table capacity
91  explicit simpleObjectRegistry(const label size = 128)
92  :
94  {}
95 
96 
97  // Member Functions
98 
99  //- Set values (invoke callbacks) from dictionary entries
100  // Reporting honours the infoDetailLevel
101  void setValues(const dictionary& dict, bool report=false);
102 
103  //- Set named value, but also handle embedded 'name=value' syntax
104  // Treats 'name=' and 'name' identically.
105  //
106  // Will also accept a floating point value, but the called objects
107  // need to handle that.
108  // Reporting honours the infoDetailLevel
109  void setNamedValue(std::string name, int val, bool report=false);
110 
111  //- Deprecated(2021-09) renamed to setNamedValue
112  // \deprecated(2021-09) renamed to setNamedValue
113  void setNamedInt(std::string name, int val, bool report=false)
114  {
115  this->setNamedValue(name, val, report);
116  }
117 };
118 
119 
120 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
121 
122 } // End namespace Foam
123 
124 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
125 
126 #endif
127 
128 // ************************************************************************* //
Foam::simpleObjectRegistryEntry::simpleObjectRegistryEntry
simpleObjectRegistryEntry(const List< simpleRegIOobject * > &data)
Construct with a List of objects.
Definition: simpleObjectRegistry.H:70
Foam::simpleObjectRegistry::setValues
void setValues(const dictionary &dict, bool report=false)
Set values (invoke callbacks) from dictionary entries.
Definition: simpleObjectRegistry.C:38
Foam::one
A class representing the concept of 1 (one) that can be used to avoid manipulating objects known to b...
Definition: one.H:61
Foam::simpleObjectRegistry::setNamedInt
void setNamedInt(std::string name, int val, bool report=false)
Deprecated(2021-09) renamed to setNamedValue.
Definition: simpleObjectRegistry.H:112
Foam::simpleObjectRegistryEntry
Definition: simpleObjectRegistry.H:56
Foam::simpleObjectRegistry::setNamedValue
void setNamedValue(std::string name, int val, bool report=false)
Set named value, but also handle embedded 'name=value' syntax.
Definition: simpleObjectRegistry.C:92
Foam::simpleObjectRegistryEntry::simpleObjectRegistryEntry
simpleObjectRegistryEntry(simpleRegIOobject *obj)
Construct with a single object (list size == 1)
Definition: simpleObjectRegistry.H:64
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:123
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Dictionary.H
Foam::Dictionary
General purpose template dictionary class that manages the storage associated with it.
Definition: Dictionary.H:57
Foam::List
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition: BitOps.H:63
simpleRegIOobject.H
Foam::name
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
Definition: exprTraits.C:59
Foam::simpleObjectRegistry::simpleObjectRegistry
simpleObjectRegistry(const label size=128)
Construct with given or default (128) table capacity.
Definition: simpleObjectRegistry.H:90
Foam::data
Database for solution data, solver performance and other reduced data.
Definition: data.H:55
Foam::simpleRegIOobject
Abstract base class for registered object with I/O. Used in debug symbol registration.
Definition: simpleRegIOobject.H:52
Foam::simpleObjectRegistry
Object registry for simpleRegIOobject. Maintains ordering.
Definition: simpleObjectRegistry.H:81