Loading...
Searching...
No Matches
IOobjectListI.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) 2022-2024 OpenCFD Ltd.
9-------------------------------------------------------------------------------
10License
11 This file is part of OpenFOAM.
12
13 OpenFOAM is free software: you can redistribute it and/or modify it
14 under the terms of the GNU General Public License as published by
15 the Free Software Foundation, either version 3 of the License, or
16 (at your option) any later version.
17
18 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 for more details.
22
23 You should have received a copy of the GNU General Public License
24 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25
26\*---------------------------------------------------------------------------*/
27
28// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
30inline Foam::IOobjectList::IOobjectList(const label initialCapacity)
31:
32 HashPtrTable<IOobject>(initialCapacity)
33{}
34
39{}
40
50 const objectRegistry& db,
51 const fileName& instance,
53)
54:
55 IOobjectList(db, instance, fileName::null, ioOpt)
56{}
57
58
60(
61 const objectRegistry& db,
62 const fileName& instance,
64)
65:
67 (
68 db,
69 instance,
70 fileName::null,
72 (
73 IOobjectOption::MUST_READ,
74 IOobjectOption::NO_WRITE,
75 registerObject
76 )
77 )
78{}
79
80
82(
83 const objectRegistry& db,
84 const fileName& instance,
85 const fileName& local,
87)
88:
90 (
91 db,
92 instance,
93 local,
95 (
96 IOobjectOption::MUST_READ,
97 IOobjectOption::NO_WRITE,
98 registerObject
99 )
100 )
101{}
102
103
104// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
105
106inline bool Foam::IOobjectList::add(std::unique_ptr<IOobject>&& objectPtr)
107{
108 if (objectPtr)
109 {
110 return insert(objectPtr->name(), std::move(objectPtr));
111 }
112
113 return false;
114}
115
116
117inline bool Foam::IOobjectList::add(autoPtr<IOobject>& objectPtr)
118{
119 if (objectPtr)
120 {
121 return insert(objectPtr->name(), std::move(objectPtr));
122 }
123
124 return false;
125}
126
127
128inline bool Foam::IOobjectList::add(autoPtr<IOobject>&& objectPtr)
129{
130 if (objectPtr)
131 {
132 return insert(objectPtr->name(), std::move(objectPtr));
133 }
135 return false;
136}
137
138
139// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
140
142{
143 transfer(list);
144}
145
146
147// ************************************************************************* //
constexpr HashPtrTable() noexcept=default
void transfer(HashTable< T, Key, Hash > &rhs)
Transfer contents into this table.
Definition HashTable.C:794
List of IOobjects with searching and retrieving facilities. Implemented as a HashTable,...
void operator=(const IOobjectList &)=delete
No copy assignment.
IOobjectList() noexcept=default
Default construct: empty without allocation (capacity=0).
bool add(std::unique_ptr< IOobject > &&objectPtr)
Move insert IOobject into the list.
A simple container of IOobject preferences. Can also be used for general handling of read/no-read/rea...
registerOption
Enumeration for use with registerObject(). Values map to bool (false/true).
Defines the attributes of an object for which implicit objectRegistry management is supported,...
Definition IOobject.H:191
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition autoPtr.H:65
A class for handling file names.
Definition fileName.H:75
Registry of regIOobjects.
bool local
Definition EEqn.H:20
const direction noexcept
Definition scalarImpl.H:265
nonInt insert("surfaceSum(((S|magSf)*S)")