/*---------------------------------------------------------------------------*\ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org \\ / A nd | Copyright (C) 2011-2026 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License This file is part of OpenFOAM. OpenFOAM is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. OpenFOAM is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenFOAM. If not, see . \*---------------------------------------------------------------------------*/ #include "IOList.H" // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // template < template class Container, template class IOContainer, class Type > Foam::IOListBase::IOListBase(const IOobject& io) : regIOobject(io) { // Check for MUST_READ_IF_MODIFIED if (!IOContainer::rereading) { warnNoRereading>(); } if ( ( io.readOpt() == IOobject::MUST_READ || io.readOpt() == IOobject::MUST_READ_IF_MODIFIED ) || (io.readOpt() == IOobject::READ_IF_PRESENT && headerOk()) ) { // For if MUST_READ_IF_MODIFIED if (IOContainer::rereading) { addWatch(); } readStream(IOContainer::typeName) >> *this; close(); } } template < template class Container, template class IOContainer, class Type > Foam::IOListBase::IOListBase ( const IOobject& io, const bool read ) : regIOobject(io) { // Check for MUST_READ_IF_MODIFIED if (!IOContainer::rereading) { warnNoRereading>(); } if ( io.readOpt() == IOobject::MUST_READ || io.readOpt() == IOobject::MUST_READ_IF_MODIFIED ) { // For if MUST_READ_IF_MODIFIED if (IOContainer::rereading) { addWatch(); } Istream& is = readStream(IOContainer::typeName, read); if (read) { is >> *this; } close(); } else if (io.readOpt() == IOobject::READ_IF_PRESENT) { bool haveFile = headerOk(); Istream& is = readStream(IOContainer::typeName, haveFile && read); if (read && haveFile) { is >> *this; } close(); } } template < template class Container, template class IOContainer, class Type > Foam::IOListBase::IOListBase ( const IOobject& io, const label size ) : regIOobject(io) { // Check for MUST_READ_IF_MODIFIED if (!IOContainer::rereading) { warnNoRereading>(); } if ( ( io.readOpt() == IOobject::MUST_READ || io.readOpt() == IOobject::MUST_READ_IF_MODIFIED ) || (io.readOpt() == IOobject::READ_IF_PRESENT && headerOk()) ) { // For if MUST_READ_IF_MODIFIED if (IOContainer::rereading) { addWatch(); } readStream(IOContainer::typeName) >> *this; close(); } else { Container::setSize(size); } } template < template class Container, template class IOContainer, class Type > Foam::IOListBase::IOListBase ( const IOobject& io, const Container& l ) : regIOobject(io) { // Check for MUST_READ_IF_MODIFIED if (!IOContainer::rereading) { warnNoRereading>(); } if ( ( io.readOpt() == IOobject::MUST_READ || io.readOpt() == IOobject::MUST_READ_IF_MODIFIED ) || (io.readOpt() == IOobject::READ_IF_PRESENT && headerOk()) ) { // For if MUST_READ_IF_MODIFIED if (IOContainer::rereading) { addWatch(); } readStream(IOContainer::typeName) >> *this; close(); } else { Container::operator=(l); } } template < template class Container, template class IOContainer, class Type > Foam::IOListBase::IOListBase ( const IOobject& io, Container&& l ) : regIOobject(io), Container(move(l)) { // Check for MUST_READ_IF_MODIFIED if (!IOContainer::rereading) { warnNoRereading>(); } if ( ( io.readOpt() == IOobject::MUST_READ || io.readOpt() == IOobject::MUST_READ_IF_MODIFIED ) || (io.readOpt() == IOobject::READ_IF_PRESENT && headerOk()) ) { // For if MUST_READ_IF_MODIFIED if (IOContainer::rereading) { addWatch(); } readStream(IOContainer::typeName) >> *this; close(); } } template < template class Container, template class IOContainer, class Type > template Foam::IOListBase::IOListBase ( const IOobject& io, const Expression& e ) : regIOobject(io) { // Check for MUST_READ_IF_MODIFIED if (!IOContainer::rereading) { warnNoRereading>(); } if ( ( io.readOpt() == IOobject::MUST_READ || io.readOpt() == IOobject::MUST_READ_IF_MODIFIED ) || (io.readOpt() == IOobject::READ_IF_PRESENT && headerOk()) ) { // For if MUST_READ_IF_MODIFIED if (IOContainer::rereading) { addWatch(); } readStream(IOContainer::typeName) >> *this; close(); } else { Container::operator=(e); } } template < template class Container, template class IOContainer, class Type > Foam::IOListBase::IOListBase ( const IOListBase& f ) : regIOobject(f), Container(f) {} template < template class Container, template class IOContainer, class Type > Foam::IOListBase::IOListBase ( IOListBase&& f ) : regIOobject(move(f)), Container(move(f)) {} // * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * * // template < template class Container, template class IOContainer, class Type > Foam::IOListBase::~IOListBase() {} // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // template < template class Container, template class IOContainer, class Type > bool Foam::IOListBase::writeData ( Ostream& os ) const { return (os << static_cast&>(*this)).good(); } // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * // template < template class Container, template class IOContainer, class Type > void Foam::IOListBase::operator= ( const IOListBase& rhs ) { Container::operator=(rhs); } template < template class Container, template class IOContainer, class Type > void Foam::IOListBase::operator= ( IOListBase&& rhs ) { Container::operator=(move(rhs)); } // ************************************************************************* //