All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
IOobjectList.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 Class
25  Foam::IOobjectList
26 
27 Description
28  List of IOobjects with searching and retrieving facilities.
29 
30 SourceFiles
31  IOobjectList.C
32 
33 \*---------------------------------------------------------------------------*/
34 
35 #ifndef IOobjectList_H
36 #define IOobjectList_H
37 
38 #include "HashPtrTable.H"
39 #include "IOobject.H"
40 #include "wordReList.H"
41 
42 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
43 
44 namespace Foam
45 {
46 
47 /*---------------------------------------------------------------------------*\
48  Class IOobjectList Declaration
49 \*---------------------------------------------------------------------------*/
50 
51 class IOobjectList
52 :
53  public HashPtrTable<IOobject>
54 {
55 
56 public:
57 
58  // Constructors
59 
60  //- Construct given an initial estimate for the number of entries
61  explicit IOobjectList(const label nIoObjects = 128);
62 
63  //- Construct from objectRegistry and instance path
65  (
66  const objectRegistry& db,
67  const fileName& instance,
68  const fileName& local = "",
71  bool registerObject = true
72  );
73 
74  //- Copy constructor
75  IOobjectList(const IOobjectList&);
76 
77 
78  //- Destructor
79  ~IOobjectList();
80 
81 
82  // Member Functions
83 
84  //- Add an IOobject to the list
85  bool add(IOobject&);
86 
87  //- Remove an IOobject from the list
88  bool remove(IOobject&);
89 
90  //- Lookup a given name and return IOobject ptr if found else nullptr
91  IOobject* lookup(const word& name) const;
92 
93  //- Return the list for all IOobects whose name matches name
94  IOobjectList lookup(const wordRe& name) const;
95 
96  //- Return the list for all IOobects whose name matches name
97  IOobjectList lookup(const wordReList& patterns) const;
98 
99  //- Return the list for all IOobjects of a given class
100  IOobjectList lookupClass(const word& className) const;
101 
102  //- Return the list of names of the IOobjects
103  wordList names() const;
104 
105  //- Return the sorted list of names of the IOobjects
106  wordList sortedNames() const;
107 
108  //- Return the list of names of the IOobjects of given class
109  wordList names(const word& className) const;
110 
111  //- Return the sorted list of names of the IOobjects of given class
112  wordList sortedNames(const word& className) const;
113 
114 
115  // Member Operators
116 
117  //- Disallow default bitwise assignment
118  void operator=(const IOobjectList&) = delete;
119 };
120 
121 
122 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
123 
124 } // End namespace Foam
125 
126 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
127 
128 #endif
129 
130 // ************************************************************************* //
writeOption
Enumeration defining the write options.
Definition: IOobject.H:119
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
A class for handling file names.
Definition: fileName.H:79
List of IOobjects with searching and retrieving facilities.
Definition: IOobjectList.H:50
wordList sortedNames() const
Return the sorted list of names of the IOobjects.
Definition: IOobjectList.C:219
wordList names() const
Return the list of names of the IOobjects.
Definition: IOobjectList.C:213
A HashTable specialization for hashing pointers.
Definition: HashPtrTable.H:50
readOption
Enumeration defining the read options.
Definition: IOobject.H:110
bool add(IOobject &)
Add an IOobject to the list.
Definition: IOobjectList.C:101
A class for handling words, derived from string.
Definition: word.H:59
A wordRe is a word, but can also have a regular expression for matching words.
Definition: wordRe.H:74
word name(const complex &)
Return a string representation of a complex.
Definition: complex.C:47
IOobjectList lookupClass(const word &className) const
Return the list for all IOobjects of a given class.
Definition: IOobjectList.C:192
void operator=(const IOobjectList &)=delete
Disallow default bitwise assignment.
~IOobjectList()
Destructor.
Definition: IOobjectList.C:95
Registry of regIOobjects.
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
Definition: IOobject.H:92
IOobjectList(const label nIoObjects=128)
Construct given an initial estimate for the number of entries.
Definition: IOobjectList.C:33
Namespace for OpenFOAM.
IOobject * lookup(const word &name) const
Lookup a given name and return IOobject ptr if found else nullptr.
Definition: IOobjectList.C:123