ENH: Improved basicSource I/O

This commit is contained in:
andy
2011-11-02 13:56:15 +00:00
parent 11f421d4b5
commit 557b67011a
2 changed files with 19 additions and 5 deletions

View File

@ -369,11 +369,17 @@ public:
// I-O
//- Write the source header information
virtual void writeHeader(Ostream&) const;
//- Write the source footer information
virtual void writeFooter(Ostream&) const;
//- Write the source properties
virtual void writeData(Ostream&) const = 0;
virtual void writeData(Ostream&) const;
//- Read source dictionary
virtual bool read(const dictionary& dict) = 0;
virtual bool read(const dictionary& dict);
};

View File

@ -27,11 +27,21 @@ License
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::basicSource::writeData(Ostream& os) const
void Foam::basicSource::writeHeader(Ostream& os) const
{
os << indent << name_ << nl
<< indent << token::BEGIN_BLOCK << incrIndent << nl;
}
void Foam::basicSource::writeFooter(Ostream& os) const
{
os << decrIndent << indent << token::END_BLOCK << endl;
}
void Foam::basicSource::writeData(Ostream& os) const
{
os.writeKeyword("active") << active_ << token::END_STATEMENT << nl;
os.writeKeyword("timeStart") << timeStart_ << token::END_STATEMENT << nl;
os.writeKeyword("duration") << duration_ << token::END_STATEMENT << nl;
@ -70,8 +80,6 @@ void Foam::basicSource::writeData(Ostream& os) const
<< abort(FatalError);
}
}
os << decrIndent << indent << token::END_BLOCK << endl;
}