Go to the documentation of this file.
31 template<
class T,
class BaseType>
34 Istream& is = readStream(word::null);
38 is >>
static_cast<List<T>&
>(*this);
41 else if (headerClassName() == typeName)
49 <<
"unexpected class name " << headerClassName()
52 <<
" while reading object " <<
name()
58 template<
class T,
class BaseType>
65 size += this->operator[](i).size();
77 template<
class T,
class BaseType>
84 io.
readOpt() == IOobject::MUST_READ
85 || (io.
readOpt() == IOobject::READ_IF_PRESENT && headerOk())
93 template<
class T,
class BaseType>
104 io.readOpt() == IOobject::MUST_READ
105 || (io.readOpt() == IOobject::READ_IF_PRESENT && headerOk())
117 template<
class T,
class BaseType>
128 io.readOpt() == IOobject::MUST_READ
129 || (io.readOpt() == IOobject::READ_IF_PRESENT && headerOk())
141 template<
class T,
class BaseType>
154 io.readOpt() == IOobject::MUST_READ
155 || (io.readOpt() == IOobject::READ_IF_PRESENT && headerOk())
165 template<
class T,
class BaseType>
173 template<
class T,
class BaseType>
181 if (fmt == IOstream::ASCII)
184 const word oldTypeName = typeName;
188 bool good = regIOobject::writeObject(fmt, ver, cmp);
191 const_cast<word&
>(typeName) = oldTypeName;
195 else if (overflows())
198 <<
"Overall number of elements of CompactIOList of size "
199 << this->size() <<
" overflows the representation of a label"
200 <<
endl <<
" Switching to ascii writing" <<
endl;
203 const word oldTypeName = typeName;
207 bool good = regIOobject::writeObject(IOstream::ASCII, ver, cmp);
210 const_cast<word&
>(typeName) = oldTypeName;
216 return regIOobject::writeObject(fmt, ver, cmp);
221 template<
class T,
class BaseType>
224 return (os << *
this).good();
230 template<
class T,
class BaseType>
240 template<
class T,
class BaseType>
249 template<
class T,
class BaseType>
261 L.setSize(start.size()-1);
267 label index = start[i];
268 subList.setSize(start[i+1] - index);
272 subList[j] = elems[index++];
280 template<
class T,
class BaseType>
288 if (os.format() == IOstream::ASCII)
290 os << static_cast<const List<T>&>(L);
298 for (
label i = 1; i < start.size(); i++)
300 label prev = start[i-1];
301 start[i] = prev+L[i-1].size();
306 <<
"Overall number of elements " << start[i]
307 <<
" of CompactIOList of size "
308 << L.size() <<
" overflows the representation of a label"
309 <<
endl <<
"Please recompile with a larger representation"
319 const T& subList = L[i];
323 elems[elemI++] = subList[j];
326 os << start << elems;
points setSize(newPointi)
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
bool overflows() const
Has too many elements in it?
A class for handling words, derived from string.
List< label > labelList
A List of labels.
#define forAll(list, i)
Loop across all elements in list.
virtual bool writeObject(IOstream::streamFormat, IOstream::versionNumber, IOstream::compressionType) const
CompactIOList(const IOobject &)
Construct from IOobject.
compressionType
Enumeration for the format of data in the stream.
Ostream & endl(Ostream &os)
Add newline and flush stream.
void readFromStream()
Read according to header type.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
readOption readOpt() const
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
A List of objects of type <T> with automated input and output using a compact storage....
virtual bool writeData(Ostream &) const
errorManipArg< error, int > exit(error &err, const int errNo=1)
void operator=(const CompactIOList< T, BaseType > &)
regIOobject is an abstract class derived from IOobject to handle automatic object registration with t...
A List of objects of type <T> with automated input and output.
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
#define WarningInFunction
Report a warning using Foam::Warning.
word name(const complex &)
Return a string representation of a complex.
streamFormat
Enumeration for the format of data in the stream.