Function1: Rationalized the stream output

This commit is contained in:
Henry Weller
2016-02-08 21:43:56 +00:00
parent bc7d6ff57c
commit 1e3e700b84
11 changed files with 5 additions and 186 deletions

View File

@ -61,16 +61,6 @@ SourceFiles
namespace Foam namespace Foam
{ {
// Forward declaration of friend functions and operators
namespace Function1Types
{
template<class Type> class CSV;
};
template<class Type>
Ostream& operator<<(Ostream&, const Function1Types::CSV<Type>&);
namespace Function1Types namespace Function1Types
{ {
@ -151,20 +141,8 @@ public:
// Member Functions // Member Functions
// Access //- Return const access to the file name
virtual const fileName& fName() const;
//- Return const access to the file name
virtual const fileName& fName() const;
// I/O
//- Ostream Operator
friend Ostream& operator<< <Type>
(
Ostream& os,
const CSV<Type>& cnst
);
//- Write in dictionary format //- Write in dictionary format
virtual void writeData(Ostream& os) const; virtual void writeData(Ostream& os) const;

View File

@ -27,28 +27,6 @@ License
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * // // * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
template<class Type>
Foam::Ostream& Foam::operator<<
(
Ostream& os,
const Function1Types::CSV<Type>& tbl
)
{
os << static_cast<const Function1<Type>& >(tbl)
<< token::SPACE << tbl.nHeaderLine_
<< token::SPACE << tbl.timeColumn_
<< token::SPACE << tbl.componentColumns_
<< token::SPACE << tbl.separator_
<< token::SPACE << tbl.mergeSeparators_
<< token::SPACE << tbl.fileName_;
// Check state of Ostream
os.check("Ostream& operator<<(Ostream&, const CSV<Type>&)");
return os;
}
template<class Type> template<class Type>
void Foam::Function1Types::CSV<Type>::writeData(Ostream& os) const void Foam::Function1Types::CSV<Type>::writeData(Ostream& os) const
{ {

View File

@ -46,16 +46,6 @@ SourceFiles
namespace Foam namespace Foam
{ {
// Forward declaration of friend functions and operators
namespace Function1Types
{
template<class Type> class Constant;
};
template<class Type>
Ostream& operator<<(Ostream&, const Function1Types::Constant<Type>&);
namespace Function1Types namespace Function1Types
{ {
@ -118,16 +108,6 @@ public:
//- Integrate between two values //- Integrate between two values
Type integrate(const scalar x1, const scalar x2) const; Type integrate(const scalar x1, const scalar x2) const;
// I/O
//- Ostream Operator
friend Ostream& operator<< <Type>
(
Ostream& os,
const Constant<Type>& cnst
);
//- Write in dictionary format //- Write in dictionary format
virtual void writeData(Ostream& os) const; virtual void writeData(Ostream& os) const;
}; };

View File

@ -27,26 +27,6 @@ License
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * // // * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
template<class Type>
Foam::Ostream& Foam::operator<<
(
Ostream& os,
const Function1Types::Constant<Type>& cnst
)
{
os << static_cast<const Function1<Type>& >(cnst)
<< token::SPACE << cnst.value_;
// Check state of Ostream
os.check
(
"Ostream& operator<<(Ostream&, const Constant<Type>&)"
);
return os;
}
template<class Type> template<class Type>
void Foam::Function1Types::Constant<Type>::writeData(Ostream& os) const void Foam::Function1Types::Constant<Type>::writeData(Ostream& os) const
{ {

View File

@ -31,7 +31,7 @@ template<class Type>
Foam::Ostream& Foam::operator<< Foam::Ostream& Foam::operator<<
( (
Ostream& os, Ostream& os,
const Function1<Type>& de const Function1<Type>& f1
) )
{ {
// Check state of Ostream // Check state of Ostream
@ -40,7 +40,8 @@ Foam::Ostream& Foam::operator<<
"Ostream& operator<<(Ostream&, const Function1<Type>&)" "Ostream& operator<<(Ostream&, const Function1<Type>&)"
); );
os << de.name_; os << f1.name_;
f1.writeData(os);
return os; return os;
} }

View File

@ -53,16 +53,6 @@ SourceFiles
namespace Foam namespace Foam
{ {
// Forward declaration of friend functions and operators
namespace Function1Types
{
template<class Type> class Polynomial;
};
template<class Type>
Ostream& operator<<(Ostream&, const Function1Types::Polynomial<Type>&);
namespace Function1Types namespace Function1Types
{ {
@ -138,15 +128,6 @@ public:
Type integrate(const scalar x1, const scalar x2) const; Type integrate(const scalar x1, const scalar x2) const;
// I/O
//- Ostream Operator
friend Ostream& operator<< <Type>
(
Ostream& os,
const Polynomial<Type>& cnst
);
//- Write in dictionary format //- Write in dictionary format
virtual void writeData(Ostream& os) const; virtual void writeData(Ostream& os) const;
}; };

View File

@ -27,26 +27,6 @@ License
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * // // * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
template<class Type>
Foam::Ostream& Foam::operator<<
(
Ostream& os,
const Function1Types::Polynomial<Type>& poly
)
{
os << static_cast<const Function1<Type>& >(poly)
<< token::SPACE << poly.coeffs_;
// Check state of Ostream
os.check
(
"Ostream& operator<<(Ostream&, const Polynomial&)"
);
return os;
}
template<class Type> template<class Type>
void Foam::Function1Types::Polynomial<Type>::writeData(Ostream& os) const void Foam::Function1Types::Polynomial<Type>::writeData(Ostream& os) const
{ {

View File

@ -52,16 +52,6 @@ SourceFiles
namespace Foam namespace Foam
{ {
// Forward declaration of friend functions and operators
namespace Function1Types
{
template<class Type> class Table;
};
template<class Type>
Ostream& operator<<(Ostream&, const Function1Types::Table<Type>&);
namespace Function1Types namespace Function1Types
{ {

View File

@ -45,15 +45,6 @@ namespace Foam
class interpolationWeights; class interpolationWeights;
// Forward declaration of friend functions and operators
namespace Function1Types
{
template<class Type> class TableBase;
};
template<class Type>
Ostream& operator<<(Ostream&, const Function1Types::TableBase<Type>&);
namespace Function1Types namespace Function1Types
{ {
@ -167,16 +158,6 @@ public:
//- Return the dependent values //- Return the dependent values
virtual tmp<Field<Type>> y() const; virtual tmp<Field<Type>> y() const;
// I/O
//- Ostream Operator
friend Ostream& operator<< <Type>
(
Ostream& os,
const TableBase<Type>& tbl
);
//- Write all table data in dictionary format //- Write all table data in dictionary format
virtual void writeData(Ostream& os) const; virtual void writeData(Ostream& os) const;

View File

@ -27,26 +27,6 @@ License
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * // // * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
template<class Type>
Foam::Ostream& Foam::operator<<
(
Ostream& os,
const Function1Types::TableBase<Type>& tbl
)
{
os << static_cast<const Function1<Type>&>(tbl);
os << token::SPACE << tbl.table_;
// Check state of Ostream
os.check
(
"Ostream& operator<<(Ostream&, const TableBase<Type>&, const bool)"
);
return os;
}
template<class Type> template<class Type>
void Foam::Function1Types::TableBase<Type>::writeData(Ostream& os) const void Foam::Function1Types::TableBase<Type>::writeData(Ostream& os) const
{ {

View File

@ -63,16 +63,6 @@ SourceFiles
namespace Foam namespace Foam
{ {
// Forward declaration of friend functions and operators
namespace Function1Types
{
template<class Type> class TableFile;
};
template<class Type>
Ostream& operator<<(Ostream&, const Function1Types::TableFile<Type>&);
namespace Function1Types namespace Function1Types
{ {