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-2019 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  if (group.empty())
34  {
35  return name;
36  }
37 
38  return name + ('.' + group);
39 }
40 
41 
42 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
43 
44 // General access
45 
46 inline const Foam::word& Foam::IOobject::name() const
47 {
48  return name_;
49 }
50 
51 
53 {
54  return name_.ext();
55 }
56 
57 
59 {
60  return name_.lessExt();
61 }
62 
63 
65 {
66  return headerClassName_;
67 }
68 
69 
71 {
72  return headerClassName_;
73 }
74 
75 
76 inline const Foam::string& Foam::IOobject::note() const
77 {
78  return note_;
79 }
80 
81 
83 {
84  return note_;
85 }
86 
87 
88 inline bool Foam::IOobject::registerObject() const
89 {
90  return registerObject_;
91 }
92 
93 
95 {
96  return registerObject_;
97 }
98 
99 
100 inline bool Foam::IOobject::globalObject() const
101 {
102  return globalObject_;
103 }
104 
105 
107 {
108  return globalObject_;
109 }
110 
111 
112 inline unsigned Foam::IOobject::labelByteSize() const
113 {
114  return labelByteSize_;
115 }
116 
117 
118 inline unsigned Foam::IOobject::scalarByteSize() const
119 {
120  return scalarByteSize_;
121 }
122 
123 
124 // Checks
125 
126 inline bool Foam::IOobject::isHeaderClassName(const word& clsName) const
127 {
128  return (clsName == headerClassName_);
129 }
130 
131 
132 template<class Type>
134 {
135  return (Type::typeName == headerClassName_);
136 }
137 
138 
139 // Read/write options
140 
142 {
143  return rOpt_;
144 }
145 
146 
148 {
149  return rOpt_;
150 }
151 
152 
154 {
155  return wOpt_;
156 }
157 
158 
160 {
161  return wOpt_;
162 }
163 
164 
165 // Path components
166 
168 {
169  return instance_;
170 }
171 
172 
174 {
175  return instance_;
176 }
177 
178 
180 {
181  return local_;
182 }
183 
184 
186 {
187  return path()/name();
188 }
189 
190 
191 // Error Handling
192 
193 inline bool Foam::IOobject::good() const
194 {
195  return objState_ == GOOD;
196 }
197 
198 
199 inline bool Foam::IOobject::bad() const
200 {
201  return objState_ == BAD;
202 }
203 
204 
205 // ************************************************************************* //
Foam::word::lessExt
word lessExt() const
Return word without extension (part before last .)
Definition: word.C:113
Foam::IOobject::name
const word & name() const
Return name.
Definition: IOobjectI.H:46
Foam::IOobject::scalarByteSize
unsigned scalarByteSize() const
The scalar byte-size, possibly read from the header.
Definition: IOobjectI.H:118
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::IOobject::instance
const fileName & instance() const
Definition: IOobjectI.H:167
Foam::IOobject::isHeaderClassName
bool isHeaderClassName() const
Test if headerClassName() equals Type::typeName.
Definition: IOobjectI.H:133
Foam::constant::atomic::group
const char *const group
Group name for atomic constants.
Definition: atomicConstants.C:41
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:112
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:88
Foam::IOobject::local
const fileName & local() const
Definition: IOobjectI.H:179
Foam::IOobject::writeOpt
writeOption writeOpt() const
The write option.
Definition: IOobjectI.H:153
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:100
Foam::IOobject::good
bool good() const
Definition: IOobjectI.H:193
Foam::IOobject::headerClassName
const word & headerClassName() const
Return name of the class name read from header.
Definition: IOobjectI.H:64
Foam::IOobject::note
const string & note() const
Return the optional note.
Definition: IOobjectI.H:76
Foam::IOobject::groupName
static word groupName(StringType name, const word &group)
Create dot-delimited name.group.
Foam::IOobject::member
word member() const
Return member (name without the extension)
Definition: IOobjectI.H:58
Foam::IOobject::readOpt
readOption readOpt() const
The read option.
Definition: IOobjectI.H:141
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:52
Foam::IOobject::bad
bool bad() const
Definition: IOobjectI.H:199
Foam::IOobject::readOption
readOption
Enumeration defining the read options.
Definition: IOobject.H:118
Foam::IOobject::objectPath
fileName objectPath() const
The complete path + object name.
Definition: IOobjectI.H:185