IOobjectI.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) 2017-2020 OpenCFD Ltd.
9 -------------------------------------------------------------------------------
10 License
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 // * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
29 
30 template<class StringType>
32 (
33  StringType base,
34  const word& group
35 )
36 {
37  if (group.empty())
38  {
39  return base;
40  }
41 
42  return base + ('.' + group);
43 }
44 
45 
46 template<class StringType>
48 (
49  StringType scope,
50  const word& name
51 )
52 {
53  if (name.empty())
54  {
55  return scope;
56  }
57  else if (scope.empty())
58  {
59  return name;
60  }
61 
62  return scope + (IOobject::scopeSeparator + name);
63 }
64 
65 
66 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
67 
68 // General access
69 
70 inline const Foam::word& Foam::IOobject::name() const
71 {
72  return name_;
73 }
74 
75 
77 {
78  return name_.ext();
79 }
80 
81 
83 {
84  return name_.lessExt();
85 }
86 
87 
89 {
90  return headerClassName_;
91 }
92 
93 
95 {
96  return headerClassName_;
97 }
98 
99 
100 inline const Foam::string& Foam::IOobject::note() const
101 {
102  return note_;
103 }
104 
105 
107 {
108  return note_;
109 }
110 
111 
113 {
114  return registerObject_;
115 }
116 
117 
119 {
120  return registerObject_;
121 }
122 
123 
124 inline bool Foam::IOobject::globalObject() const
125 {
126  return globalObject_;
127 }
128 
129 
131 {
132  return globalObject_;
133 }
134 
135 
136 inline unsigned Foam::IOobject::labelByteSize() const
137 {
138  return labelByteSize_;
139 }
140 
141 
142 inline unsigned Foam::IOobject::scalarByteSize() const
143 {
144  return scalarByteSize_;
145 }
146 
147 
148 // Checks
149 
150 inline bool Foam::IOobject::isHeaderClassName(const word& clsName) const
151 {
152  return (clsName == headerClassName_);
153 }
154 
155 
156 template<class Type>
158 {
159  return (Type::typeName == headerClassName_);
160 }
161 
162 
163 // Read/write options
164 
166 {
167  return rOpt_;
168 }
169 
170 
172 {
173  return rOpt_;
174 }
175 
176 
178 {
179  return wOpt_;
180 }
181 
182 
184 {
185  return wOpt_;
186 }
187 
188 
189 // Path components
190 
192 {
193  return instance_;
194 }
195 
196 
198 {
199  return instance_;
200 }
201 
202 
204 {
205  return local_;
206 }
207 
208 
210 {
211  return path()/name();
212 }
213 
214 
215 // Error Handling
216 
217 inline bool Foam::IOobject::good() const
218 {
219  return objState_ == GOOD;
220 }
221 
222 
223 inline bool Foam::IOobject::bad() const
224 {
225  return objState_ == BAD;
226 }
227 
228 
229 // ************************************************************************* //
Foam::word::lessExt
word lessExt() const
Return word without extension (part before last .)
Definition: word.C:113
Foam::IOobject::scopedName
static word scopedName(StringType scope, const word &name)
Create scope:name or scope_name string.
Foam::IOobject::name
const word & name() const
Return name.
Definition: IOobjectI.H:70
Foam::IOobject::scalarByteSize
unsigned scalarByteSize() const
The scalar byte-size, possibly read from the header.
Definition: IOobjectI.H:142
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:62
Foam::fileName
A class for handling file names.
Definition: fileName.H:69
Foam::constant::atomic::group
constexpr const char *const group
Group name for atomic constants.
Definition: atomicConstants.H:52
Foam::IOobject::instance
const fileName & instance() const
Definition: IOobjectI.H:191
Foam::IOobject::isHeaderClassName
bool isHeaderClassName() const
Test if headerClassName() equals Type::typeName.
Definition: IOobjectI.H:157
Foam::string
A class for handling character strings derived from std::string.
Definition: string.H:73
Foam::word::ext
word ext() const
Return file name extension (part after last .)
Definition: word.C:126
Foam::IOobject::labelByteSize
unsigned labelByteSize() const
The label byte-size, possibly read from the header.
Definition: IOobjectI.H:136
Foam::IOobject::writeOption
writeOption
Enumeration defining the write options.
Definition: IOobject.H:127
Foam::IOobject::registerObject
bool registerObject() const
Should object created with this IOobject be registered?
Definition: IOobjectI.H:112
Foam::IOobject::local
const fileName & local() const
Definition: IOobjectI.H:203
Foam::IOobject::writeOpt
writeOption writeOpt() const
The write option.
Definition: IOobjectI.H:177
Foam::name
word name(const complex &c)
Return string representation of complex.
Definition: complex.C:76
Foam::IOobject::globalObject
bool globalObject() const
Is object same for all processors?
Definition: IOobjectI.H:124
Foam::IOobject::good
bool good() const
Definition: IOobjectI.H:217
Foam::IOobject::headerClassName
const word & headerClassName() const
Return name of the class name read from header.
Definition: IOobjectI.H:88
Foam::IOobject::note
const string & note() const
Return the optional note.
Definition: IOobjectI.H:100
Foam::IOobject::member
word member() const
Return member (name without the extension)
Definition: IOobjectI.H:82
Foam::IOobject::readOpt
readOption readOpt() const
The read option.
Definition: IOobjectI.H:165
path
fileName path(UMean.rootPath()/UMean.caseName()/"graphs"/UMean.instance())
Foam::IOobject::group
word group() const
Return group (extension part of name)
Definition: IOobjectI.H:76
Foam::IOobject::bad
bool bad() const
Definition: IOobjectI.H:223
Foam::IOobject::readOption
readOption
Enumeration defining the read options.
Definition: IOobject.H:118
Foam::IOobject::groupName
static word groupName(StringType base, const word &group)
Create dot-delimited name.group string.
Foam::IOobject::objectPath
fileName objectPath() const
The complete path + object name.
Definition: IOobjectI.H:209