119 #if (WM_LABEL_SIZE == 64)
233 const
word& compoundType,
235 const
bool readContent = true
241 const Type*
isA()
const
243 return dynamic_cast<const Type*
>(
this);
256 void moved(
bool b)
noexcept
271 virtual label
size()
const = 0;
274 virtual void resize(
const label
n) = 0;
306 virtual std::streamsize
size_bytes()
const = 0;
332 typedef typename T::value_type valueType;
340 T::operator=(valueType());
372 T(std::move(content))
387 template<
class... Args>
400 virtual label
size()
const
406 virtual void resize(
const label
n)
412 virtual void fill_zero() { _m_fill_zero(); }
424 operator<<(os, static_cast<const T&>(*
this));
450 return T::cdata_bytes();
456 return T::data_bytes();
462 return T::size_bytes();
523 inline Type getIntegral(const
char* expected) const;
527 inline Type getArithmetic(const
char* expected) const;
530 void parseError(const
char* expected) const;
538 static constexpr const
char* const
typeName =
"token";
556 inline explicit
token(int32_t val, label lineNum=0)
noexcept;
559 inline explicit
token(int64_t val, label lineNum=0)
noexcept;
562 inline explicit
token(uint32_t val, label lineNum=0)
noexcept;
565 inline explicit
token(uint64_t val, label lineNum=0)
noexcept;
574 inline explicit
token(const
word& w, label lineNum=0);
577 inline explicit
token(const
string& str, label lineNum=0);
580 inline explicit
token(
word&& w, label lineNum=0);
583 inline explicit
token(
string&& str, label lineNum=0);
720 inline
bool isWord(const std::
string&
s) const;
761 explicit operator
bool() const
noexcept {
return good(); }
839 inline scalar
number()
const;
870 const word& compoundType,
872 const bool readContent =
true
948 inline void operator=(
const string& str);
957 inline void operator=(token::compound* ptr);
960 inline void operator=(autoPtr<token::compound>&& ptr);
967 inline bool operator==(
const int32_t val)
const noexcept;
968 inline bool operator==(
const int64_t val)
const noexcept;
969 inline bool operator==(
const uint32_t val)
const noexcept;
970 inline bool operator==(
const uint64_t val)
const noexcept;
971 inline bool operator==(
const float val)
const noexcept;
972 inline bool operator==(
const double val)
const noexcept;
973 inline bool operator==(
const std::string&)
const;
999 friend ostream&
operator<<(ostream&
os,
const InfoProxy<token>& ip);
1053#define defineCompoundTypeName(Type, UnusedTag) \
1054 defineTemplateTypeNameWithName(token::Compound<Type>, #Type);
1057#define defineNamedCompoundTypeName(Type, Name) \
1058 defineTemplateTypeNameWithName(token::Compound<Type>, #Name);
1061#define addCompoundToRunTimeSelectionTable(Type, Tag) \
1062 token::compound::addemptyConstructorToTable<token::Compound<Type>> \
1063 add##Tag##emptyConstructorToTable_;
1066#define addNamedCompoundToRunTimeSelectionTable(Type, Tag, Name) \
1067 token::compound::addemptyConstructorToTable<token::Compound<Type>> \
1068 add##Tag##emptyConstructorToTable_(#Name);
A helper class for outputting values to Ostream.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
A traits class, which is primarily used for primitives and vector-space.
Reference counter for various OpenFOAM components.
constexpr refCount() noexcept
Default construct, initializing count to 0.
A templated class for holding compound tokens. The underlying container is normally a List of values,...
virtual label size() const
The size of the underlying content.
TypeNameNoDebug("Compound<T>")
Declare type-name, virtual type (without debug switch).
virtual direction nComponents() const
The number of vector-space or other components of the underlying data content.
Compound(T &&content)
Move construct from base content.
Compound(const T &content)
Copy construct from base content.
Compound()=default
Default construct.
virtual void fill_zero()
Fill with zero value or with default value initialized.
virtual void write(Ostream &os) const
Redirect write to underlying content.
virtual tokenType typeCode() const
The token type (if any) corresponding to the contained component type (LABEL, FLOAT,...
Compound(const Compound< T > &)=delete
No copy construct.
Compound(Istream &is)
Read construct from Istream.
virtual const char * cdata_bytes() const
Pointer to the underlying data as byte data.
virtual void read(Istream &is)
Redirect read to underlying content.
virtual direction rank() const
The vector-space rank associated with the data content.
virtual char * data_bytes()
Pointer to the underlying data as byte data.
virtual void resize(const label n)
Change the size of the underlying content.
const::Foam::word typeName("List<edge>")
T::value_type value_type
The type of values held by the compound.
static autoPtr< compound > New(Args &&... args)
Construct autoPtr compound with forwarding arguments.
void operator=(const Compound< T > &)=delete
No copy assignment.
virtual std::streamsize size_bytes() const
Size of the (contiguous) byte data.
Abstract base class for complex tokens.
void moved(bool b) noexcept
Set compound transferred status.
virtual void resize(const label n)=0
Change the size of the underlying container content.
constexpr compound() noexcept
Default construct.
friend Ostream & operator<<(Ostream &os, const compound &ct)
Output operator.
virtual const char * cdata_bytes() const =0
Pointer to the underlying data as byte data.
unsigned char state_
The compound token state, internally used values only.
bool moved() const noexcept
Get compound transferred status.
void pending(bool b) noexcept
Set compound pending-read status.
virtual direction rank() const =0
The vector-space rank associated with the data content.
virtual std::streamsize size_bytes() const =0
Size of the (contiguous) byte data.
virtual direction nComponents() const =0
The number of vector-space or other components of the underlying data content.
virtual ~compound() noexcept=default
Destructor.
declareRunTimeSelectionTable(autoPtr, compound, empty,(),())
Declare run-time constructor selection table.
TypeNameNoDebug("compound")
Declare type-name, virtual type (without debug switch).
virtual void read(Istream &is)=0
Read from stream into the underlying content.
bool pending() const noexcept
Get compound pending-read status.
virtual void fill_zero()=0
Fill with zero values, or with default constructed.
virtual label size() const =0
The size of the underlying content.
const Type * isA() const
Attempt dynamic_cast to Type returns nullptr if cast is not possible.
virtual tokenType typeCode() const =0
The token type (if any) corresponding to the contained component type (LABEL, FLOAT,...
static autoPtr< compound > New(const word &compoundType)
Default construct specified compound type.
virtual char * data_bytes()=0
Pointer to the underlying data as byte data.
virtual void write(Ostream &os) const =0
Write the underlying content.
A token holds an item read from Istream.
bool isIntType() const noexcept
Token is (int32 | int64 | uint32 | uint64).
bool isNumber() const noexcept
Token is (signed/unsigned) integer type, FLOAT or DOUBLE.
void swap(token &tok) noexcept
Swap token contents: type, data, line-number.
bool operator!=(uint64_t b) const noexcept
friend Ostream & operator<<(Ostream &os, const punctuationToken &pt)
tokenType
Enumeration defining the types of token.
@ LABEL
compatibility name
@ ERROR
Token error encountered.
@ DOUBLE
double (double-precision) type
@ FLAG
stream flag (1-byte bitmask)
@ UNSIGNED_INTEGER_32
uint32 type
@ UNDEFINED
An undefined token-type.
@ COMPOUND
Compound type such as List<label> etc.
@ FLOAT_SCALAR
compatibility name for FLOAT
@ CHAR_DATA
String-variant: plain character content.
@ FLOAT
float (single-precision) type
@ DOUBLE_SCALAR
compatibility name for DOUBLE
@ VERBATIMSTRING
compatibility name for VERBATIM
@ UNSIGNED_INTEGER_64
uint64 type
@ STRING
Foam::string (usually double-quoted).
@ PUNCTUATION
single character punctuation
label lineNumber() const noexcept
The line number for the token.
bool isBool() const noexcept
Token is BOOL.
static word name(const token::tokenType tokType)
Return the name for the token type.
bool isSeparator() const noexcept
Token is PUNCTUATION and isseparator.
bool operator!=(int64_t b) const noexcept
bool operator!=(int32_t b) const noexcept
bool isPunctuation() const noexcept
Token is PUNCTUATION.
friend ostream & operator<<(ostream &os, const punctuationToken &pt)
void operator=(word *)=delete
Deprecated(2017-11) transfer word pointer to the token.
bool isExpression() const noexcept
Token is EXPRESSION (string variant).
compound & refCompoundToken()
Return reference to compound token. Fatal if the wrong type. No checks for released or pending states...
bool is_int64() const noexcept
Token is INTEGER_64 or is convertible to one.
punctuationToken
Standard punctuation tokens (a character).
@ LBRACE
Left brace [isseparator].
@ BEGIN_STRING
Begin string with double quote.
@ DIVIDE
Divide [isseparator].
@ BEGIN_BLOCK
Begin block [isseparator].
@ BEGIN_SQR
Begin dimensions [isseparator].
@ COLON
Colon [isseparator].
@ RPAREN
Right parenthesis [isseparator].
@ END_BLOCK
End block [isseparator].
@ HASH
Hash - directive or start verbatim string.
@ LPAREN
Left parenthesis [isseparator].
@ RSQUARE
Right square bracket [isseparator].
@ END_STRING
End string with double quote.
@ LSQUARE
Left square bracket [isseparator].
@ ASSIGN
Assignment/equals [isseparator].
@ SEMICOLON
Semicolon [isseparator].
@ END_STATEMENT
End entry [isseparator].
@ NULL_TOKEN
Nul character.
@ BEGIN_LIST
Begin list [isseparator].
@ PLUS
Addition [isseparator].
@ DOLLAR
Dollar - start variable or expression.
@ RBRACE
Right brace [isseparator].
@ SUBTRACT
Subtract or start of negative number.
@ END_LIST
End list [isseparator].
@ ADD
Addition [isseparator].
@ QUESTION
Question mark (eg, ternary).
@ END_SQR
End dimensions [isseparator].
@ MULTIPLY
Multiply [isseparator].
@ MINUS
Subtract or start of negative number.
@ COMMA
Comma [isseparator].
float floatToken() const
Return float value.
label & lineNumber() noexcept
Write access for the token line number.
bool isLabel() const noexcept
Integral token is convertible to Foam::label.
const string & stringToken() const
Return const reference to the string contents.
bool is_int32() const noexcept
Token is INTEGER_32 or is convertible to one.
punctuationToken pToken() const
Return punctuation character.
bool operator==(const token &tok) const
bool good() const noexcept
True if token is not UNDEFINED or ERROR.
double doubleScalarToken() const
Return double value.
float floatScalarToken() const
Return float value.
void setBad()
Clear token and set to be ERROR.
label labelToken() const
Return integer type as label value or Error.
bool isDouble() const noexcept
Token is DOUBLE.
static bool isseparator(int c) noexcept
True if the character is a punctuation separator (eg, in ISstream).
bool isString() const noexcept
Token is string-variant (STRING, EXPRESSION, VARIABLE, VERBATIM, CHAR_DATA).
bool readCompoundToken(const word &compoundType, Istream &is, const bool readContent=true)
Default construct the specified compound type and read from stream.
bool operator!=(double b) const noexcept
flagType
Stream or output control flags (1-byte width).
@ BINARY
BINARY-mode stream.
@ ASCII
ASCII-mode stream.
constexpr token() noexcept
Default construct, initialized to an UNDEFINED token.
bool boolToken() const
Return boolean token value.
bool is_uint32() const noexcept
Token is UNSIGNED_INTEGER_32 or is convertible to one.
bool isULabel() const noexcept
Integral token is convertible to Foam::uLabel.
friend ostream & operator<<(ostream &os, const InfoProxy< token > &ip)
bool isScalar() const noexcept
Token is FLOAT or DOUBLE.
bool isDoubleScalar() const noexcept
Token is DOUBLE.
bool operator!=(uint32_t b) const noexcept
double doubleToken() const
Return double value.
const compound & compoundToken() const
Const reference to compound token. Fatal if the wrong type.
bool isDirective() const noexcept
Token is DIRECTIVE (word variant).
uint32_t uint32Token() const
Return int32 value, convert from other integer type or Error.
static constexpr const char *const typeName
The type name is "token".
bool isFlag() const noexcept
Token is FLAG.
uLabel uLabelToken() const
Return integer type as uLabel value or Error.
bool setType(const tokenType tokType) noexcept
Change the token type, for similar types.
int flagToken() const
Return flag bitmask value.
friend Ostream & operator<<(Ostream &os, const token &tok)
bool operator!=(const std::string &s) const
bool undefined() const noexcept
Token is UNDEFINED.
bool is_uint64() const noexcept
Token is UNSIGNED_INTEGER_64 or is convertible to one.
tokenType type() const noexcept
Return the token type.
bool isQuotedString() const noexcept
Token is (quoted) STRING (string variant).
compound & transferCompoundToken(const Istream *is=nullptr)
Return reference to compound and mark internally as released.
bool isCompound() const noexcept
Token is COMPOUND.
int64_t int64Token() const
Return int64 value, convert from other integer type or Error.
bool error() const noexcept
Token is ERROR.
bool isFloat() const noexcept
Token is FLOAT.
bool isStringType() const noexcept
Token is word-variant or string-variant (WORD, DIRECTIVE, STRING, EXPRESSION, VARIABLE,...
bool isFloatScalar() const noexcept
Token is FLOAT.
bool isVariable() const noexcept
Token is VARIABLE (string variant).
void reset()
Reset token to UNDEFINED and clear any allocated storage.
int32_t int32Token() const
Return int32 value, convert from other integer type or Error.
void operator=(string *)=delete
Deprecated(2017-11) transfer string pointer to the token.
static const token undefinedToken
An undefined token.
bool isCharData() const noexcept
Token is CHAR_DATA (string variant).
const word & wordToken() const
Return const reference to the word contents.
bool isWord() const noexcept
Token is word-variant (WORD, DIRECTIVE).
bool operator!=(punctuationToken p) const noexcept
scalar scalarToken() const
Return float or double value.
bool operator!=(float b) const noexcept
bool read(Istream &is)
Read a token from Istream, calls reset() first.
uint64_t uint64Token() const
Return int64 value, convert from other integer type or Error.
bool isVerbatim() const noexcept
Token is VERBATIM string (string variant).
static token flag(int bitmask) noexcept
Create a token with stream flags, no sanity check.
void operator=(const token &tok)
Copy assign.
InfoProxy< token > info() const noexcept
Return info proxy, for printing token information to a stream.
scalar number() const
Return label, float or double value.
bool operator!=(const token &t) const
A class for handling words, derived from Foam::string.
OBJstream os(runTime.globalPath()/outputName)
gmvFile<< "tracers "<< particles.size()<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().x()<< " ";}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().y()<< " ";}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().z()<< " ";}gmvFile<< nl;forAll(lagrangianScalarNames, i){ word name=lagrangianScalarNames[i];IOField< scalar > s(IOobject(name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces).
Istream & operator>>(Istream &, directionInfo &)
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
Macros to ease declaration of run-time selection tables.
#define declareRunTimeSelectionTable(ptrWrapper, baseType, argNames, argList, parList)
Declare a run-time selection (variables and adder classes).
Foam::argList args(argc, argv)
Test for pTraits zero : default is false.
The vector-space number of components: default is 1.
The vector-space rank: default is 0.
Basic run-time type information using word as the type's name. Used to enhance the standard RTTI to c...
#define TypeNameNoDebug(TypeNameString)
Declare a ClassNameNoDebug() with extra virtual type info.