Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Development
openfoam
Commits
d362c223
Commit
d362c223
authored
Jul 24, 2018
by
Mark OLESEN
Browse files
COMP/STYLE: change read() -> readIstream() for private methods
- this eliminates a degree of ambiguity when resolving a read() method in inherited classes.
parent
94a89d53
Changes
14
Hide whitespace changes
Inline
Side-by-side
src/OpenFOAM/containers/Dictionaries/DictionaryBase/DictionaryBase.H
View file @
d362c223
...
...
@@ -56,7 +56,7 @@ SourceFiles
namespace
Foam
{
// Forward declaration
of friend functions and operator
s
// Forward declarations
template
<
class
IDLListType
,
class
T
>
class
DictionaryBase
;
...
...
@@ -96,34 +96,34 @@ public:
DictionaryBase
(
const
label
size
=
128
);
//- Copy construct
DictionaryBase
(
const
DictionaryBase
&
);
DictionaryBase
(
const
DictionaryBase
&
dict
);
//- Construct from Istream using given Istream constructor class
template
<
class
INew
>
DictionaryBase
(
Istream
&
,
const
INew
&
);
DictionaryBase
(
Istream
&
is
,
const
INew
&
inew
);
//- Construct from Istream using default Istream constructor class
DictionaryBase
(
Istream
&
);
DictionaryBase
(
Istream
&
is
);
// Member functions
// Search and lookup
//- Search
DictionaryBase
for given keyword
bool
found
(
const
word
&
)
const
;
//- Search for given keyword
bool
found
(
const
word
&
keyword
)
const
;
//- Find and return an entry if present, otherwise return nullptr
const
T
*
lookupPtr
(
const
word
&
)
const
;
const
T
*
lookupPtr
(
const
word
&
keyword
)
const
;
//- Find and return an entry if present, otherwise return nullptr
T
*
lookupPtr
(
const
word
&
);
T
*
lookupPtr
(
const
word
&
keyword
);
//- Find and return entry
const
T
*
lookup
(
const
word
&
)
const
;
const
T
*
lookup
(
const
word
&
keyword
)
const
;
//- Find and return entry
T
*
lookup
(
const
word
&
);
T
*
lookup
(
const
word
&
keyword
);
//- Return the table of contents
wordList
toc
()
const
;
...
...
src/OpenFOAM/containers/Dictionaries/PtrDictionary/PtrDictionary.C
View file @
d362c223
...
...
@@ -56,6 +56,4 @@ Foam::PtrDictionary<T>::PtrDictionary(Istream& is)
{}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// ************************************************************************* //
src/OpenFOAM/containers/Dictionaries/PtrDictionary/PtrDictionary.H
View file @
d362c223
...
...
@@ -64,14 +64,14 @@ public:
PtrDictionary
(
const
label
size
=
128
);
//- Copy construct
PtrDictionary
(
const
PtrDictionary
&
);
PtrDictionary
(
const
PtrDictionary
&
dict
);
//- Construct from Istream using given Istream constructor class
template
<
class
INew
>
PtrDictionary
(
Istream
&
,
const
INew
&
);
PtrDictionary
(
Istream
&
is
,
const
INew
&
inew
);
//- Construct from Istream
PtrDictionary
(
Istream
&
);
PtrDictionary
(
Istream
&
is
);
// Member operators
...
...
src/OpenFOAM/containers/Dictionaries/PtrListDictionary/PtrListDictionary.H
View file @
d362c223
...
...
@@ -64,14 +64,14 @@ public:
PtrListDictionary
(
const
label
size
);
//- Copy construct
PtrListDictionary
(
const
PtrListDictionary
&
);
PtrListDictionary
(
const
PtrListDictionary
&
dict
);
//- Construct from Istream using given Istream constructor class
template
<
class
INew
>
PtrListDictionary
(
Istream
&
,
const
INew
&
);
PtrListDictionary
(
Istream
&
is
,
const
INew
&
inew
);
//- Construct from Istream
PtrListDictionary
(
Istream
&
);
PtrListDictionary
(
Istream
&
is
);
// Member functions
...
...
src/OpenFOAM/containers/HashTables/HashPtrTable/HashPtrTable.H
View file @
d362c223
...
...
@@ -69,11 +69,11 @@ class HashPtrTable
{
// Private Member Functions
//- Read from Istream using
given
Istream constructor class
//- Read from Istream using Istream constructor class
template
<
class
INew
>
void
read
(
Istream
&
is
,
const
INew
&
inew
);
void
read
Istream
(
Istream
&
is
,
const
INew
&
inew
);
//- Read from dictionary using
given dictionary
constructor class
//- Read from dictionary using
Istream
constructor class
template
<
class
INew
>
void
read
(
const
dictionary
&
dict
,
const
INew
&
inew
);
...
...
src/OpenFOAM/containers/HashTables/HashPtrTable/HashPtrTableIO.C
View file @
d362c223
...
...
@@ -33,7 +33,11 @@ License
template
<
class
T
,
class
Key
,
class
Hash
>
template
<
class
INew
>
void
Foam
::
HashPtrTable
<
T
,
Key
,
Hash
>::
read
(
Istream
&
is
,
const
INew
&
inew
)
void
Foam
::
HashPtrTable
<
T
,
Key
,
Hash
>::
readIstream
(
Istream
&
is
,
const
INew
&
inew
)
{
is
.
fatalCheck
(
FUNCTION_NAME
);
...
...
@@ -41,7 +45,7 @@ void Foam::HashPtrTable<T, Key, Hash>::read(Istream& is, const INew& inew)
is
.
fatalCheck
(
"HashPtrTable::read
(
Istream
&, const INew&)
: "
"HashPtrTable::readIstream : "
"reading first token"
);
...
...
@@ -69,7 +73,7 @@ void Foam::HashPtrTable<T, Key, Hash>::read(Istream& is, const INew& inew)
is
.
fatalCheck
(
"HashPtrTable::read
(
Istream
&, const INew&)
: "
"HashPtrTable::readIstream : "
"reading entry"
);
}
...
...
@@ -114,7 +118,7 @@ void Foam::HashPtrTable<T, Key, Hash>::read(Istream& is, const INew& inew)
is
.
fatalCheck
(
"HashPtrTable::read
(
Istream
&, const INew&)
: "
"HashPtrTable::readIstream : "
"reading entry"
);
...
...
@@ -172,14 +176,14 @@ template<class T, class Key, class Hash>
template
<
class
INew
>
Foam
::
HashPtrTable
<
T
,
Key
,
Hash
>::
HashPtrTable
(
Istream
&
is
,
const
INew
&
inew
)
{
this
->
read
(
is
,
inew
);
this
->
read
Istream
(
is
,
inew
);
}
template
<
class
T
,
class
Key
,
class
Hash
>
Foam
::
HashPtrTable
<
T
,
Key
,
Hash
>::
HashPtrTable
(
Istream
&
is
)
{
this
->
read
(
is
,
INew
<
T
>
());
this
->
read
Istream
(
is
,
INew
<
T
>
());
}
...
...
@@ -196,7 +200,7 @@ template<class T, class Key, class Hash>
Foam
::
Istream
&
Foam
::
operator
>>
(
Istream
&
is
,
HashPtrTable
<
T
,
Key
,
Hash
>&
tbl
)
{
tbl
.
clear
();
tbl
.
read
(
is
,
INew
<
T
>
());
tbl
.
read
Istream
(
is
,
INew
<
T
>
());
return
is
;
}
...
...
src/OpenFOAM/containers/LinkedLists/accessTypes/ILList/ILList.H
View file @
d362c223
...
...
@@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd.
\\/ M anipulation | Copyright (C) 2017
-2018
OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
...
...
@@ -69,7 +69,7 @@ class ILList
//- Read from Istream using given Istream constructor class
template
<
class
INew
>
void
read
(
Istream
&
is
,
const
INew
&
inew
);
void
read
Istream
(
Istream
&
is
,
const
INew
&
inew
);
public:
...
...
@@ -138,7 +138,7 @@ public:
friend
Istream
&
operator
>>
<
LListBase
,
T
>
(
Istream
&
is
,
ILList
<
LListBase
,
T
>&
lst
ILList
<
LListBase
,
T
>&
l
i
st
);
};
...
...
src/OpenFOAM/containers/LinkedLists/accessTypes/ILList/ILListIO.C
View file @
d362c223
...
...
@@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd.
\\/ M anipulation | Copyright (C) 2017
-2018
OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
...
...
@@ -31,13 +31,17 @@ License
template
<
class
LListBase
,
class
T
>
template
<
class
INew
>
void
Foam
::
ILList
<
LListBase
,
T
>::
read
(
Istream
&
is
,
const
INew
&
inew
)
void
Foam
::
ILList
<
LListBase
,
T
>::
read
Istream
(
Istream
&
is
,
const
INew
&
inew
)
{
is
.
fatalCheck
(
FUNCTION_NAME
);
token
firstToken
(
is
);
is
.
fatalCheck
(
"ILList::readList : reading first token"
);
is
.
fatalCheck
(
"ILList::readIstream : "
"reading first token"
);
if
(
firstToken
.
isLabel
())
{
...
...
@@ -55,7 +59,11 @@ void Foam::ILList<LListBase, T>::read(Istream& is, const INew& inew)
T
*
p
=
inew
(
is
).
ptr
();
this
->
append
(
p
);
is
.
fatalCheck
(
"ILList::readList : reading entry"
);
is
.
fatalCheck
(
"ILList::readIstream : "
"reading entry"
);
}
}
else
...
...
@@ -63,7 +71,11 @@ void Foam::ILList<LListBase, T>::read(Istream& is, const INew& inew)
T
*
p
=
inew
(
is
).
ptr
();
this
->
append
(
p
);
is
.
fatalCheck
(
"ILList::readList : reading entry"
);
is
.
fatalCheck
(
"ILList::readIstream : "
"reading the single entry"
);
for
(
label
i
=
1
;
i
<
len
;
++
i
)
{
...
...
@@ -122,24 +134,24 @@ template<class LListBase, class T>
template
<
class
INew
>
Foam
::
ILList
<
LListBase
,
T
>::
ILList
(
Istream
&
is
,
const
INew
&
inew
)
{
this
->
read
(
is
,
inew
);
this
->
read
Istream
(
is
,
inew
);
}
template
<
class
LListBase
,
class
T
>
Foam
::
ILList
<
LListBase
,
T
>::
ILList
(
Istream
&
is
)
{
this
->
read
(
is
,
INew
<
T
>
());
this
->
read
Istream
(
is
,
INew
<
T
>
());
}
// * * * * * * * * * * * * * * * Istream Operator * * * * * * * * * * * * * //
template
<
class
LListBase
,
class
T
>
Foam
::
Istream
&
Foam
::
operator
>>
(
Istream
&
is
,
ILList
<
LListBase
,
T
>&
lst
)
Foam
::
Istream
&
Foam
::
operator
>>
(
Istream
&
is
,
ILList
<
LListBase
,
T
>&
l
i
st
)
{
lst
.
clear
();
lst
.
read
(
is
,
INew
<
T
>
());
l
i
st
.
clear
();
l
i
st
.
read
Istream
(
is
,
INew
<
T
>
());
return
is
;
}
...
...
src/OpenFOAM/containers/LinkedLists/accessTypes/LPtrList/LPtrList.H
View file @
d362c223
...
...
@@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd.
\\/ M anipulation | Copyright (C) 2017
-2018
OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
...
...
@@ -51,14 +51,14 @@ template<class LListBase, class T>
Istream
&
operator
>>
(
Istream
&
is
,
LPtrList
<
LListBase
,
T
>&
lst
LPtrList
<
LListBase
,
T
>&
l
i
st
);
template
<
class
LListBase
,
class
T
>
Ostream
&
operator
<<
(
Ostream
&
os
,
const
LPtrList
<
LListBase
,
T
>&
lst
const
LPtrList
<
LListBase
,
T
>&
l
i
st
);
...
...
@@ -77,7 +77,7 @@ private:
//- Read from Istream using given Istream constructor class
template
<
class
INew
>
void
read
(
Istream
&
is
,
const
INew
&
inew
);
void
read
Istream
(
Istream
&
is
,
const
INew
&
inew
);
public:
...
...
@@ -419,13 +419,13 @@ public:
friend
Istream
&
operator
>>
<
LListBase
,
T
>
(
Istream
&
is
,
LPtrList
<
LListBase
,
T
>&
lst
LPtrList
<
LListBase
,
T
>&
l
i
st
);
friend
Ostream
&
operator
<<
<
LListBase
,
T
>
(
Ostream
&
os
,
const
LPtrList
<
LListBase
,
T
>&
lst
const
LPtrList
<
LListBase
,
T
>&
l
i
st
);
};
...
...
src/OpenFOAM/containers/LinkedLists/accessTypes/LPtrList/LPtrListIO.C
View file @
d362c223
...
...
@@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd.
\\/ M anipulation | Copyright (C) 2017
-2018
OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
...
...
@@ -32,13 +32,17 @@ License
template
<
class
LListBase
,
class
T
>
template
<
class
INew
>
void
Foam
::
LPtrList
<
LListBase
,
T
>::
read
(
Istream
&
is
,
const
INew
&
inew
)
void
Foam
::
LPtrList
<
LListBase
,
T
>::
read
Istream
(
Istream
&
is
,
const
INew
&
inew
)
{
is
.
fatalCheck
(
FUNCTION_NAME
);
token
firstToken
(
is
);
is
.
fatalCheck
(
"LPtrList::readList : reading first token"
);
is
.
fatalCheck
(
"LPtrList::readIstream : "
"reading first token"
);
if
(
firstToken
.
isLabel
())
{
...
...
@@ -56,7 +60,11 @@ void Foam::LPtrList<LListBase, T>::read(Istream& is, const INew& inew)
T
*
p
=
inew
(
is
).
ptr
();
this
->
append
(
p
);
is
.
fatalCheck
(
"LPtrList::readList : reading entry"
);
is
.
fatalCheck
(
"LPtrList::readIstream : "
"reading entry"
);
}
}
else
...
...
@@ -64,7 +72,11 @@ void Foam::LPtrList<LListBase, T>::read(Istream& is, const INew& inew)
T
*
p
=
inew
(
is
).
ptr
();
this
->
append
(
p
);
is
.
fatalCheck
(
"LPtrList::readList : reading entry"
);
is
.
fatalCheck
(
"LPtrList::readIstream : "
"reading the single entry"
);
for
(
label
i
=
1
;
i
<
len
;
++
i
)
{
...
...
@@ -125,24 +137,24 @@ template<class LListBase, class T>
template
<
class
INew
>
Foam
::
LPtrList
<
LListBase
,
T
>::
LPtrList
(
Istream
&
is
,
const
INew
&
inew
)
{
this
->
read
(
is
,
inew
);
this
->
read
Istream
(
is
,
inew
);
}
template
<
class
LListBase
,
class
T
>
Foam
::
LPtrList
<
LListBase
,
T
>::
LPtrList
(
Istream
&
is
)
{
this
->
read
(
is
,
INew
<
T
>
());
this
->
read
Istream
(
is
,
INew
<
T
>
());
}
// * * * * * * * * * * * * * * * Istream Operator * * * * * * * * * * * * * //
template
<
class
LListBase
,
class
T
>
Foam
::
Istream
&
Foam
::
operator
>>
(
Istream
&
is
,
LPtrList
<
LListBase
,
T
>&
L
)
Foam
::
Istream
&
Foam
::
operator
>>
(
Istream
&
is
,
LPtrList
<
LListBase
,
T
>&
list
)
{
L
.
clear
();
L
.
read
(
is
,
INew
<
T
>
());
list
.
clear
();
list
.
read
Istream
(
is
,
INew
<
T
>
());
return
is
;
}
...
...
@@ -151,13 +163,17 @@ Foam::Istream& Foam::operator>>(Istream& is, LPtrList<LListBase, T>& L)
// * * * * * * * * * * * * * * * Ostream Operators * * * * * * * * * * * * * //
template
<
class
LListBase
,
class
T
>
Foam
::
Ostream
&
Foam
::
operator
<<
(
Ostream
&
os
,
const
LPtrList
<
LListBase
,
T
>&
lst
)
Foam
::
Ostream
&
Foam
::
operator
<<
(
Ostream
&
os
,
const
LPtrList
<
LListBase
,
T
>&
list
)
{
// Size and start delimiter
os
<<
nl
<<
lst
.
size
()
<<
nl
<<
token
::
BEGIN_LIST
<<
nl
;
os
<<
nl
<<
l
i
st
.
size
()
<<
nl
<<
token
::
BEGIN_LIST
<<
nl
;
// Contents
for
(
auto
iter
=
lst
.
cbegin
();
iter
!=
lst
.
cend
();
++
iter
)
for
(
auto
iter
=
l
i
st
.
cbegin
();
iter
!=
l
i
st
.
cend
();
++
iter
)
{
os
<<
*
iter
<<
nl
;
}
...
...
src/OpenFOAM/containers/PtrLists/PtrList/PtrList.H
View file @
d362c223
...
...
@@ -73,9 +73,9 @@ protected:
// Protected Member Functions
//- Read from Istream using
given
Istream constructor class
//- Read from Istream using Istream constructor class
template
<
class
INew
>
void
read
(
Istream
&
is
,
const
INew
&
inew
);
void
read
Istream
(
Istream
&
is
,
const
INew
&
inew
);
//- Delete the allocated entries, but retain the list size.
inline
void
free
();
...
...
src/OpenFOAM/containers/PtrLists/PtrList/PtrListIO.C
View file @
d362c223
...
...
@@ -32,7 +32,7 @@ License
template
<
class
T
>
template
<
class
INew
>
void
Foam
::
PtrList
<
T
>::
read
(
Istream
&
is
,
const
INew
&
inew
)
void
Foam
::
PtrList
<
T
>::
read
Istream
(
Istream
&
is
,
const
INew
&
inew
)
{
clear
();
// Delete old pointers and reset the list size
...
...
@@ -42,7 +42,7 @@ void Foam::PtrList<T>::read(Istream& is, const INew& inew)
is
.
fatalCheck
(
"PtrList::read
(
Istream
&)
: "
"PtrList::readIstream : "
"reading first token"
);
...
...
@@ -70,7 +70,7 @@ void Foam::PtrList<T>::read(Istream& is, const INew& inew)
is
.
fatalCheck
(
"PtrList::read
(
Istream
&)
: "
"PtrList::readIstream : "
"reading entry"
);
}
...
...
@@ -82,7 +82,7 @@ void Foam::PtrList<T>::read(Istream& is, const INew& inew)
is
.
fatalCheck
(
"PtrList::read
(
Istream
&)
: "
"PtrList::readIstream : "
"reading the single entry"
);
...
...
@@ -167,14 +167,14 @@ template<class T>
template
<
class
INew
>
Foam
::
PtrList
<
T
>::
PtrList
(
Istream
&
is
,
const
INew
&
inew
)
{
read
(
is
,
inew
);
this
->
readIstream
(
is
,
inew
);
}
template
<
class
T
>
Foam
::
PtrList
<
T
>::
PtrList
(
Istream
&
is
)
{
read
(
is
,
INew
<
T
>
());
this
->
readIstream
(
is
,
INew
<
T
>
());
}
...
...
@@ -183,7 +183,7 @@ Foam::PtrList<T>::PtrList(Istream& is)
template
<
class
T
>
Foam
::
Istream
&
Foam
::
operator
>>
(
Istream
&
is
,
PtrList
<
T
>&
list
)
{
list
.
read
(
is
,
INew
<
T
>
());
list
.
read
Istream
(
is
,
INew
<
T
>
());
return
is
;
}
...
...
src/OpenFOAM/db/IOobjects/IOPtrList/IOPtrList.C
View file @
d362c223
...
...
@@ -45,7 +45,7 @@ Foam::IOPtrList<T>::IOPtrList(const IOobject& io, const INew& inewt)
// For if MUST_READ_IF_MODIFIED
addWatch
();
PtrList
<
T
>::
read
(
readStream
(
typeName
),
inewt
);
PtrList
<
T
>::
read
Istream
(
readStream
(
typeName
),
inewt
);
close
();
}
}
...
...
@@ -68,7 +68,7 @@ Foam::IOPtrList<T>::IOPtrList(const IOobject& io)
// For if MUST_READ_IF_MODIFIED
addWatch
();
PtrList
<
T
>::
read
(
readStream
(
typeName
),
INew
<
T
>
());
PtrList
<
T
>::
read
Istream
(
readStream
(
typeName
),
INew
<
T
>
());
close
();
}
}
...
...
@@ -106,7 +106,7 @@ Foam::IOPtrList<T>::IOPtrList(const IOobject& io, const PtrList<T>& content)
// For if MUST_READ_IF_MODIFIED
addWatch
();
PtrList
<
T
>::
read
(
readStream
(
typeName
),
INew
<
T
>
());
PtrList
<
T
>::
read
Istream
(
readStream
(
typeName
),
INew
<
T
>
());
close
();
}
else
...
...
@@ -135,7 +135,7 @@ Foam::IOPtrList<T>::IOPtrList(const IOobject& io, PtrList<T>&& content)
// For if MUST_READ_IF_MODIFIED
addWatch
();
PtrList
<
T
>::
read
(
readStream
(
typeName
),
INew
<
T
>
());
PtrList
<
T
>::
read
Istream
(
readStream
(
typeName
),
INew
<
T
>
());
close
();
}
}
...
...
src/OpenFOAM/db/IOstreams/IOstreams/INew.H
View file @
d362c223
...
...
@@ -39,7 +39,7 @@ Description
namespace
Foam
{
// Forward declaration
of classe
s
// Forward declarations
class
Istream
;
/*---------------------------------------------------------------------------*\
...
...
@@ -49,32 +49,31 @@ class Istream;
template
<
class
T
>
class
INew
{
public:
//- Construct null
INew
()
{}
//-
Construct
from Istream
//-
New
from Istream
autoPtr
<
T
>
operator
()(
Istream
&
is
)
const
{
return
T
::
New
(
is
);
}
//-
Construct
from word and Istream
//-
New
from word
(unused)
and Istream
autoPtr
<
T
>
operator
()(
const
word
&
,
Istream
&
is
)
const
{
return
T
::
New
(
is
);
}
//-
Construct
from dictionary
//-
New
from dictionary
autoPtr
<
T
>
operator
()(
const
dictionary
&
dict
)
const
{
return
T
::
New
(
dict
);
}
//-
Construct
from word and dictionary
//-
New
from word
(unused)
and dictionary
autoPtr
<
T
>
operator
()(
const
word
&
,
const
dictionary
&
dict
)
const
{
return
T
::
New
(
dict
);
...
...
Write
Preview
Supports
Markdown
0%