removeRegisteredObject.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) 2013-2022 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::functionObjects::removeRegisteredObject
26 
27 Description
28  Removes registered objects if present in the database.
29 
30  Example of function object specification:
31  \verbatim
32  removeRegisteredObject1
33  {
34  type removeRegisteredObject;
35 
36  libs ("libutilityFunctionObjects.so");
37 
38  objects (obj1 obj2);
39  }
40  \endverbatim
41 
42 Usage
43  \table
44  Property | Description | Required | Default value
45  type | type name: removeRegisteredObject | yes |
46  objects | objects to remove | yes |
47  \endtable
48 
49 See also
50  Foam::functionObject
51 
52 SourceFiles
53  removeRegisteredObject.C
54 
55 \*---------------------------------------------------------------------------*/
56 
57 #ifndef functionObjects_removeRegisteredObject_H
58 #define functionObjects_removeRegisteredObject_H
59 
60 #include "functionObject.H"
61 #include "wordList.H"
62 
63 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
64 
65 namespace Foam
66 {
67 
68 // Forward declaration of classes
69 class objectRegistry;
70 
71 namespace functionObjects
72 {
73 
74 /*---------------------------------------------------------------------------*\
75  Class removeRegisteredObject Declaration
76 \*---------------------------------------------------------------------------*/
77 
78 class removeRegisteredObject
79 :
80  public functionObject
81 {
82  // Private Data
83 
84  //- Reference to the objectRegistry
85  const objectRegistry& obr_;
86 
87  //- Names of objects to control
88  wordList objectNames_;
89 
90 
91 public:
92 
93  //- Runtime type information
94  TypeName("removeRegisteredObject");
95 
96 
97  // Constructors
98 
99  //- Construct from Time and dictionary
101  (
102  const word& name,
103  const Time& runTime,
104  const dictionary& dict
105  );
106 
107  //- Disallow default bitwise copy construction
109 
110 
111  //- Destructor
112  virtual ~removeRegisteredObject();
113 
114 
115  // Member Functions
116 
117  //- Read the removeRegisteredObject data
118  virtual bool read(const dictionary&);
119 
120  //- Return the list of fields required
121  virtual wordList fields() const
122  {
123  return wordList::null();
124  }
125 
126  //- Remove the registered objects
127  virtual bool execute();
128 
129  //- Do nothing
130  virtual bool write();
131 
132 
133  // Member Operators
134 
135  //- Disallow default bitwise assignment
136  void operator=(const removeRegisteredObject&) = delete;
137 };
138 
139 
140 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
141 
142 } // End namespace functionObjects
143 } // End namespace Foam
144 
145 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
146 
147 #endif
148 
149 // ************************************************************************* //
static const List< word > & null()
Return a null List.
Definition: ListI.H:118
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition: Time.H:76
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:160
const word & name() const
Return the name of this functionObject.
Removes registered objects if present in the database.
removeRegisteredObject(const word &name, const Time &runTime, const dictionary &dict)
Construct from Time and dictionary.
virtual wordList fields() const
Return the list of fields required.
TypeName("removeRegisteredObject")
Runtime type information.
void operator=(const removeRegisteredObject &)=delete
Disallow default bitwise assignment.
virtual bool execute()
Remove the registered objects.
virtual bool read(const dictionary &)
Read the removeRegisteredObject data.
A class for handling words, derived from string.
Definition: word.H:62
Namespace for OpenFOAM.
List< word > wordList
A List of words.
Definition: fileName.H:54
dictionary dict