Go to the documentation of this file.
33 template<
unsigned W
idth>
42 template<
unsigned W
idth>
49 os << token::BEGIN_LIST <<
nl;
51 const label nblocks = debugOutput ? blocks_.size() : num_blocks(size());
52 for (label blocki = 0; blocki < nblocks; ++blocki)
57 os << token::END_LIST <<
nl;
63 template<
unsigned W
idth>
75 is.
fatalCheck(
"PackedList::readList(Istream&) : reading first token");
84 if (is.
format() == IOstream::BINARY)
95 "PackedList::readList(Istream&) : "
96 "reading the binary block"
107 if (delimiter == token::BEGIN_LIST)
109 for (label i=0; i<len; ++i)
115 "PackedList::readList(Istream&) : "
127 "PackedList::readList(Istream&) : "
128 "reading the single entry"
142 while (!tok.isPunctuation(token::END_LIST))
151 else if (tok.isPunctuation(token::BEGIN_BLOCK))
156 while (!tok.isPunctuation(token::END_BLOCK))
168 <<
"incorrect first token, expected <int>, '(' or '{', found "
177 template<
unsigned W
idth>
185 const label len = list.
size();
187 if (
os.format() == IOstream::BINARY)
199 else if (len > 1 && list.
uniform())
202 os << len << token::BEGIN_BLOCK << list[0] << token::END_BLOCK;
204 else if (!shortLen || len <= shortLen)
209 os << len << token::BEGIN_LIST;
212 for (label i=0; i < len; ++i)
214 if (i)
os << token::SPACE;
215 os << label(list.
get(i));
219 os << token::END_LIST;
226 os <<
nl << len <<
nl << token::BEGIN_LIST <<
nl;
229 for (label i=0; i < len; ++i)
231 os << label(list.
get(i)) <<
nl;
235 os << token::END_LIST <<
nl;
242 template<
unsigned W
idth>
251 os.writeKeyword(keyword);
254 os << token::END_STATEMENT <<
endl;
260 template<
unsigned W
idth>
263 return list.readList(is);
267 template<
unsigned W
idth>
271 const InfoProxy<PackedList<Width>>& iproxy
274 const PackedList<Width>& list = iproxy.t_;
276 os <<
"PackedList<" << Width
277 <<
"> size=" << list.size() <<
"/" << list.capacity()
278 <<
" (limits: max=" << PackedList<Width>::max_value
279 <<
", elem_per_block=" << PackedList<Width>::elem_per_block
void resize(const label numElem, const unsigned int val=0u)
Useful combination of include files which define Sin, Sout and Serr and the use of IO streams general...
bool isLabel() const noexcept
A class for handling words, derived from Foam::string.
char readBeginList(const char *funcName)
bool fatalCheck(const char *operation) const
streamFormat format() const noexcept
std::streamsize size_bytes() const noexcept
char readEndList(const char *funcName)
Istream & readList(Istream &is)
Istream & operator>>(Istream &, directionInfo &)
Ostream & endl(Ostream &os)
A token holds an item read from Istream.
unsigned int get(const label i) const
const char * cdata_bytes() const noexcept
Ostream & printBits(Ostream &os, bool debugOutput=false) const
InfoProxy< token > info() const
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
bool isPunctuation() const noexcept
Ostream & writeList(Ostream &os, const label shortLen=0) const
OBJstream os(runTime.globalPath()/outputName)
PackedList< Width > & append(const unsigned int val)
void setPair(Istream &is)
errorManipArg< error, int > exit(error &err, const int errNo=1)
void writeEntry(Ostream &os) const
A dynamic list of packed unsigned integers, with the number of bits per item specified by the <Width>...
void putBack(const token &tok)
label size() const noexcept
Ostream & print(Ostream &os, UIntType value, char off='0', char on='1')
char * data_bytes() noexcept
bool set(const label i, unsigned int val=~0u)
#define FatalIOErrorInFunction(ios)
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
static unsigned int readValue(Istream &is)
virtual Istream & read(token &)=0