UList: Added writeEntryList
for writing list-lists dictionary entries efficiently in binary.
This commit is contained in:
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -160,7 +160,6 @@ public:
|
||||
|
||||
// Member Functions
|
||||
|
||||
|
||||
// Access
|
||||
|
||||
//- Return the forward circular index, i.e. the next index
|
||||
@ -213,17 +212,28 @@ public:
|
||||
inline void checkIndex(const label i) const;
|
||||
|
||||
|
||||
//- Copy the pointer held by the given UList
|
||||
inline void shallowCopy(const UList<T>&);
|
||||
// Edit
|
||||
|
||||
//- Copy elements of the given UList
|
||||
void deepCopy(const UList<T>&);
|
||||
//- Copy the pointer held by the given UList
|
||||
inline void shallowCopy(const UList<T>&);
|
||||
|
||||
//- Write the UList as a dictionary entry
|
||||
void writeEntry(Ostream&) const;
|
||||
//- Copy elements of the given UList
|
||||
void deepCopy(const UList<T>&);
|
||||
|
||||
//- Write the UList as a dictionary entry with keyword
|
||||
void writeEntry(const word& keyword, Ostream&) const;
|
||||
|
||||
// Write
|
||||
|
||||
//- Write the UList as a dictionary entry
|
||||
void writeEntry(Ostream&) const;
|
||||
|
||||
//- Write the UList as a dictionary entry with keyword
|
||||
void writeEntry(const word& keyword, Ostream&) const;
|
||||
|
||||
//- Write the UList as a dictionary entry
|
||||
void writeEntryList(Ostream&) const;
|
||||
|
||||
//- Write the UList as a dictionary entry with keyword
|
||||
void writeEntryList(const word& keyword, Ostream&) const;
|
||||
|
||||
|
||||
// Member operators
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -29,7 +29,7 @@ License
|
||||
#include "SLList.H"
|
||||
#include "contiguous.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * Ostream Operator * * * * * * * * * * * * * //
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
template<class T>
|
||||
void Foam::UList<T>::writeEntry(Ostream& os) const
|
||||
@ -59,6 +59,35 @@ void Foam::UList<T>::writeEntry(const word& keyword, Ostream& os) const
|
||||
}
|
||||
|
||||
|
||||
template<class T>
|
||||
void Foam::UList<T>::writeEntryList(Ostream& os) const
|
||||
{
|
||||
// Write size and start delimiter
|
||||
os << nl << size() << nl << token::BEGIN_LIST;
|
||||
|
||||
// Write contents
|
||||
forAll(*this, i)
|
||||
{
|
||||
this->operator[](i).writeEntry(os);
|
||||
os << nl;
|
||||
}
|
||||
|
||||
// Write end delimiter
|
||||
os << nl << token::END_LIST << nl;
|
||||
}
|
||||
|
||||
|
||||
template<class T>
|
||||
void Foam::UList<T>::writeEntryList(const word& keyword, Ostream& os) const
|
||||
{
|
||||
os.writeKeyword(keyword);
|
||||
writeEntryList(os);
|
||||
os << token::END_STATEMENT << endl;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Ostream Operator * * * * * * * * * * * * * //
|
||||
|
||||
template<class T>
|
||||
Foam::Ostream& Foam::operator<<(Foam::Ostream& os, const Foam::UList<T>& L)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user