59 "List<T>::readBracketList(Istream&) : reading first token" 62 if (!tok.isPunctuation(token::BEGIN_LIST))
76 constexpr label chunkSize = 128;
77 typedef std::unique_ptr<List<T>> chunkType;
82 if (tok.isPunctuation(token::END_LIST))
93 List<chunkType> chunks(16);
96 chunks[0] = chunkType(
new List<T>(chunkSize));
100 chunks[0] = chunkType(
new List<T>(std::move(list)));
104 label totalCount = 0;
105 label localIndex = 0;
107 while (!tok.isPunctuation(token::END_LIST))
111 if (chunks[nChunks-1]->size() <= localIndex)
114 if (nChunks >= chunks.size())
116 chunks.resize(2*chunks.size());
119 chunks[nChunks] = chunkType(
new List<T>(chunkSize));
124 is >> chunks[nChunks-1]->operator[](localIndex);
130 "List<T>::readBracketList(Istream&) : " 141 list = std::move(*(chunks[0]));
147 list.setCapacity_nocopy(totalCount);
149 auto dest = list.
begin();
151 for (label chunki = 0; chunki < nChunks; ++chunki)
153 List<T> currChunk(std::move(*(chunks[chunki])));
154 chunks[chunki].reset(
nullptr);
156 const label localLen =
min(currChunk.size(), totalCount);
161 currChunk.begin(localLen),
165 totalCount -= localLen;
184 is.
fatalCheck(
"List<T>::readList(Istream&) : reading first token");
205 if (is.
format() == IOstreamOption::BINARY && is_contiguous<T>::value)
211 Detail::readContiguous<T>
220 "List<T>::readList(Istream&) : " 221 "reading binary block" 228 const auto oldFmt = is.format(IOstreamOption::BINARY);
237 "List<char>::readList(Istream&) : " 238 "reading binary block" 247 const char delimiter = is.readBeginList(
"List");
251 if (delimiter == token::BEGIN_LIST)
253 auto iter = list.
begin();
254 const auto last = list.
end();
257 for (; (iter != last); (void)++iter)
263 "List<T>::readList(Istream&) : " 277 "List<T>::readList(Istream&) : " 278 "reading the single entry" 282 UList<T>::operator=(elem);
287 is.readEndList(
"List");
294 this->readBracketList(is);
301 <<
"incorrect first token, expected <int> or '(', found " bool isPunctuation() const noexcept
Token is PUNCTUATION.
errorManipArg< error, int > exit(error &err, const int errNo=1)
void resize(const label len)
Adjust allocated size of list.
void transfer(List< T > &list)
Transfer the contents of the argument List into this list and annul the argument list.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
bool isCompound() const noexcept
Token is COMPOUND.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
constexpr char nl
The newline '\n' character (0x0a)
bool empty() const noexcept
True if List is empty (ie, size() is zero)
A token holds an item read from Istream.
void resize_nocopy(const label len)
Adjust allocated size of list without necessarily.
char * data_bytes() noexcept
Return pointer to the underlying array serving as data storage,.
void putBack(const token &tok)
Put back a token (copy). Only a single put back is permitted.
compound & transferCompoundToken(const Istream *is=nullptr)
Return reference to compound and mark internally as released.
label capacity() const noexcept
Size of the underlying storage.
void clear()
Clear the list, i.e. set size to zero.
label min(const labelHashSet &set, label minValue=labelMax)
Find the min value in labelHashSet, optionally limited by second argument.
iterator begin() noexcept
Return an iterator to begin traversing the UList.
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
Istream & readList(Istream &is)
Read List from Istream, discarding contents of existing List.
bool fatalCheck(const char *operation) const
Check IOstream status for given operation.
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
label labelToken() const
Return label value.
bool isLabel() const noexcept
Token is LABEL.
InfoProxy< token > info() const noexcept
Return info proxy, for printing token information to a stream.
iterator end() noexcept
Return an iterator to end traversing the UList.
constexpr List() noexcept
Default construct.
streamFormat format() const noexcept
Get the current stream format.
std::streamsize size_bytes() const noexcept
Number of contiguous bytes for the List data.
IOerror FatalIOError
Error stream (stdout output on all processes), with additional 'FOAM FATAL IO ERROR' header text and ...