IOPtrList.C
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 #include "IOPtrList.H"
00028
00029
00030
00031 template<class T>
00032 template<class INew>
00033 Foam::IOPtrList<T>::IOPtrList(const IOobject& io, const INew& inewt)
00034 :
00035 regIOobject(io)
00036 {
00037 if
00038 (
00039 io.readOpt() == IOobject::MUST_READ
00040 || (io.readOpt() == IOobject::READ_IF_PRESENT && headerOk())
00041 )
00042 {
00043 PtrList<T>::read(readStream(typeName), inewt);
00044 close();
00045 }
00046 }
00047
00048
00049 template<class T>
00050 Foam::IOPtrList<T>::IOPtrList(const IOobject& io)
00051 :
00052 regIOobject(io)
00053 {
00054 if
00055 (
00056 io.readOpt() == IOobject::MUST_READ
00057 || (io.readOpt() == IOobject::READ_IF_PRESENT && headerOk())
00058 )
00059 {
00060 PtrList<T>::read(readStream(typeName), INew<T>());
00061 close();
00062 }
00063 }
00064
00065
00066 template<class T>
00067 Foam::IOPtrList<T>::IOPtrList(const IOobject& io, const label s)
00068 :
00069 regIOobject(io),
00070 PtrList<T>(s)
00071 {
00072 if (io.readOpt() != IOobject::NO_READ)
00073 {
00074 FatalErrorIn("IOPtrList<T>::IOPtrList(const IOobject&, const label)")
00075 << "NO_READ must be set if specifying size" << nl
00076 << exit(FatalError);
00077 }
00078 }
00079
00080
00081 template<class T>
00082 Foam::IOPtrList<T>::IOPtrList(const IOobject& io, const PtrList<T>& list)
00083 :
00084 regIOobject(io)
00085 {
00086 if
00087 (
00088 io.readOpt() == IOobject::MUST_READ
00089 || (io.readOpt() == IOobject::READ_IF_PRESENT && headerOk())
00090 )
00091 {
00092 PtrList<T>::read(readStream(typeName), INew<T>());
00093 close();
00094 }
00095 else
00096 {
00097 PtrList<T>::operator=(list);
00098 }
00099 }
00100
00101
00102 template<class T>
00103 Foam::IOPtrList<T>::IOPtrList(const IOobject& io, const Xfer<PtrList<T> >& list)
00104 :
00105 regIOobject(io)
00106 {
00107 PtrList<T>::transfer(list());
00108
00109 if
00110 (
00111 io.readOpt() == IOobject::MUST_READ
00112 || (io.readOpt() == IOobject::READ_IF_PRESENT && headerOk())
00113 )
00114 {
00115 PtrList<T>::read(readStream(typeName), INew<T>());
00116 close();
00117 }
00118 }
00119
00120
00121
00122
00123 template<class T>
00124 Foam::IOPtrList<T>::~IOPtrList()
00125 {}
00126
00127
00128
00129
00130 template<class T>
00131 bool Foam::IOPtrList<T>::writeData(Ostream& os) const
00132 {
00133 return (os << *this).good();
00134 }
00135
00136
00137
00138
00139 template<class T>
00140 void Foam::IOPtrList<T>::operator=(const IOPtrList<T>& rhs)
00141 {
00142 PtrList<T>::operator=(rhs);
00143 }
00144
00145
Copyright © 2000-2009 OpenCFD Ltd