220 const
word& compoundType,
222 const
bool readContent = true
228 const Type*
isA()
const 230 return dynamic_cast<const Type*
>(
this);
258 virtual label
size()
const = 0;
261 virtual void resize(
const label
n) = 0;
293 virtual std::streamsize
size_bytes()
const = 0;
316 template<
class ValT =
typename T::value_type>
317 typename std::enable_if<pTraits_has_zero<ValT>::value,
void>
::type 324 template<
class ValT =
typename T::value_type>
325 typename std::enable_if<!pTraits_has_zero<ValT>::value,
void>
::type 328 T::operator=(ValT());
340 Compound(
const Compound<T>&) =
delete;
343 void operator=(
const Compound<T>&) =
delete;
359 T(
std::move(content))
374 template<
class... Args>
387 virtual label
size()
const 393 virtual void resize(
const label
n)
399 virtual void fill_zero() { _m_fill_zero(); }
411 operator<<(os, static_cast<const T&>(*this));
437 return T::cdata_bytes();
443 return T::data_bytes();
449 return T::size_bytes();
496 inline void setUndefined()
noexcept;
505 void parseError(const
char* expected) const;
536 inline explicit
token(const
float val, label lineNum=0)
noexcept;
539 inline explicit
token(const
double val, label lineNum=0)
noexcept;
542 inline explicit
token(const
word& w, label lineNum=0);
545 inline explicit
token(const
string& str, label lineNum=0);
548 inline explicit
token(
word&& w, label lineNum=0);
551 inline explicit
token(
string&& str, label lineNum=0);
670 inline
bool isWord(const
std::
string&
s) const;
711 explicit operator
bool() const
noexcept {
return good(); }
748 inline scalar
number()
const;
779 const word& compoundType,
781 const bool readContent =
true 844 inline void operator=(
const string& str);
853 inline void operator=(token::compound* ptr);
856 inline void operator=(autoPtr<token::compound>&& ptr);
866 inline bool operator==(
const std::string&
s)
const;
876 inline bool operator!=(
const std::string&
s)
const;
886 friend ostream& operator<<(ostream& os, const InfoProxy<token>& ip);
928 Ostream&
operator<<(Ostream&
os,
const token::compound& ct);
930 ostream& operator<<(ostream& os, const InfoProxy<token>& ip);
933 Ostream& operator<<(Ostream& os, const InfoProxy<token>& ip);
939 #define defineCompoundTypeName(Type, UnusedTag) \ 940 defineTemplateTypeNameWithName(token::Compound<Type>, #Type); 943 #define defineNamedCompoundTypeName(Type, Name) \ 944 defineTemplateTypeNameWithName(token::Compound<Type>, #Name); 947 #define addCompoundToRunTimeSelectionTable(Type, Tag) \ 948 token::compound::addemptyConstructorToTable<token::Compound<Type>> \ 949 add##Tag##emptyConstructorToTable_; 952 #define addNamedCompoundToRunTimeSelectionTable(Type, Tag, Name) \ 953 token::compound::addemptyConstructorToTable<token::Compound<Type>> \ 954 add##Tag##emptyConstructorToTable_(#Name); Subtract or start of negative number.
static bool isCompound(const word &compoundType)
True if a known (registered) compound type.
virtual void read(Istream &is)=0
Read from stream into the underlying content.
Begin block [isseparator].
static const token undefinedToken
An undefined token.
bool good() const noexcept
True if token is not UNDEFINED or ERROR.
double doubleScalarToken() const
Return double value.
static autoPtr< compound > New(const word &compoundType)
Default construct specified compound type.
bool isPunctuation() const noexcept
Token is PUNCTUATION.
bool operator!=(const token &tok) const
bool isDouble() const noexcept
Token is DOUBLE.
Left parenthesis [isseparator].
bool isWord() const noexcept
Token is word-variant (WORD, DIRECTIVE)
punctuationToken pToken() const
Return punctuation character.
constexpr token() noexcept
Default construct, initialized to an UNDEFINED token.
virtual tokenType typeCode() const
The token type (if any) corresponding to the contained component type (LABEL, FLOAT, DOUBLE, etc).
single character punctuation
patchWriters resize(patchIds.size())
Reference counter for various OpenFOAM components.
stream flag (1-byte bitmask)
bool isCompound() const noexcept
Token is COMPOUND.
scalar number() const
Return label, float or double value.
Begin dimensions [isseparator].
const word & wordToken() const
Return const reference to the word contents.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
A token holds an item read from Istream.
TypeNameNoDebug("Compound<T>")
Declare type-name, virtual type (without debug switch)
tokenType
Enumeration defining the types of token.
bool moved() const noexcept
Get compound transferred status.
The vector-space number of components: default is 1.
A traits class, which is primarily used for primitives and vector-space.
tokenType type() const noexcept
Return the token type.
bool isFlag() const noexcept
Token is FLAG.
Begin string with double quote.
friend Ostream & operator<<(Ostream &os, const token &tok)
Begin list [isseparator].
Subtract or start of negative number.
Assignment/equals [isseparator].
float floatToken() const
Return float value.
bool isExpression() const noexcept
Token is EXPRESSION (string variant)
bool isSeparator() const noexcept
Token is PUNCTUATION and isseparator.
virtual ~compound() noexcept=default
Destructor.
The vector-space rank: default is 0.
bool undefined() const noexcept
Token is UNDEFINED.
virtual void resize(const label n)
Change the size of the underlying content.
scalar scalarToken() const
Return float or double value.
bool boolToken() const
Return boolean token value.
Dollar - start variable or expression.
bool readCompoundToken(const word &compoundType, Istream &is, const bool readContent=true)
Default construct the specified compound type and read from stream.
word name() const
Return the name of the current token type.
declareRunTimeSelectionTable(autoPtr, compound, empty,(),())
Declare run-time constructor selection table.
static constexpr const char *const typeName
The type name is "token".
virtual void fill_zero()=0
Fill with zero values, or with default constructed.
virtual direction nComponents() const
The number of vector-space or other components of the underlying data content.
virtual std::streamsize size_bytes() const
Size of the (contiguous) byte data.
End dimensions [isseparator].
bool isScalar() const noexcept
Token is FLOAT or DOUBLE.
bool isString() const noexcept
Token is string-variant (STRING, EXPRESSION, VARIABLE, VERBATIM, CHAR_DATA)
virtual void fill_zero()
Fill with zero value or with default value initialized.
int flagToken() const
Return flag bitmask value.
Class to handle errors and exceptions in a simple, consistent stream-based manner.
Right square bracket [isseparator].
Abstract base class for complex tokens.
Compound()=default
Default construct.
A templated class for holding compound tokens. The underlying container is normally a List of values...
Right parenthesis [isseparator].
Compound type such as List<label> etc.
label lineNumber() const noexcept
The line number for the token.
double doubleToken() const
Return double value.
compatibility name for FLOAT
compound & transferCompoundToken(const Istream *is=nullptr)
Return reference to compound and mark internally as released.
Left square bracket [isseparator].
const dimensionedScalar b
Wien displacement law constant: default SI units: [m.K].
bool isStringType() const noexcept
Token is word-variant or string-variant (WORD, DIRECTIVE, STRING, EXPRESSION, VARIABLE, VERBATIM, CHAR_DATA)
virtual std::streamsize size_bytes() const =0
Size of the (contiguous) byte data.
virtual const char * cdata_bytes() const =0
Pointer to the underlying data as byte data.
A class for handling words, derived from Foam::string.
static bool isseparator(int c) noexcept
True if the character is a punctuation separator (eg, in ISstream).
virtual void resize(const label n)=0
Change the size of the underlying container content.
Istream & operator>>(Istream &, directionInfo &)
End string with double quote.
flagType
Stream or output control flags (1-byte width)
void swap(token &tok) noexcept
Swap token contents: type, data, line-number.
void setBad()
Clear token and set to be ERROR.
punctuationToken
Standard punctuation tokens (a character)
virtual void read(Istream &is)
Redirect read to underlying content.
compatibility name for VERBATIM
void operator=(const Compound< T > &)=delete
No copy assignment.
const compound & compoundToken() const
Const reference to compound token. Fatal if the wrong type.
float (single-precision) type
virtual direction nComponents() const =0
The number of vector-space or other components of the underlying data content.
float floatScalarToken() const
Return float value.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
bool isBool() const noexcept
Token is BOOL.
constexpr compound() noexcept
Default construct.
bool setType(const tokenType tokType) noexcept
Change the token type, for similar types.
The TAB Method for Numerical Calculation of Spray Droplet Breakup.
OBJstream os(runTime.globalPath()/outputName)
bool isFloatScalar() const
Token is FLOAT.
bool isDoubleScalar() const
Token is DOUBLE.
const string & stringToken() const
Return const reference to the string contents.
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
Left brace [isseparator].
unsigned char state_
The compound token state, internally used values only.
static token flag(int bitmask) noexcept
Create a token with stream flags, no sanity check.
bool operator==(const token &tok) const
Foam::string (usually double-quoted)
virtual tokenType typeCode() const =0
The token type (if any) corresponding to the contained component type (LABEL, FLOAT, DOUBLE, etc).
void operator=(const token &tok)
Copy assign.
TypeNameNoDebug("compound")
Declare type-name, virtual type (without debug switch)
virtual const char * cdata_bytes() const
Pointer to the underlying data as byte data.
bool isCharData() const noexcept
Token is CHAR_DATA (string variant)
Basic run-time type information using word as the type's name. Used to enhance the standard RTTI to c...
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces)
bool isFloat() const noexcept
Token is FLOAT.
void reset()
Reset token to UNDEFINED and clear any allocated storage.
virtual label size() const =0
The size of the underlying content.
A helper class for outputting values to Ostream.
const dimensionedScalar c
Speed of light in a vacuum.
virtual char * data_bytes()=0
Pointer to the underlying data as byte data.
label labelToken() const
Return label value.
double (double-precision) type
Right brace [isseparator].
T::value_type value_type
The type of values held by the compound.
bool isLabel() const noexcept
Token is LABEL.
InfoProxy< token > info() const noexcept
Return info proxy, for printing token information to a stream.
virtual direction rank() const =0
The vector-space rank associated with the data content.
virtual direction rank() const
The vector-space rank associated with the data content.
compound & refCompoundToken()
Return reference to compound token. Fatal if the wrong type. No checks for released or pending states...
String-variant: plain character content.
virtual char * data_bytes()
Pointer to the underlying data as byte data.
virtual void write(Ostream &os) const
Redirect write to underlying content.
Pointer management similar to std::unique_ptr, with some additional methods and type checking...
const Type * isA() const
Attempt dynamic_cast to Type returns nullptr if cast is not possible.
Macros to ease declaration of run-time selection tables.
Question mark (eg, ternary)
bool isVariable() const noexcept
Token is VARIABLE (string variant)
bool isDirective() const noexcept
Token is DIRECTIVE (word variant)
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))
Foam::argList args(argc, argv)
static autoPtr< compound > New(Args &&... args)
Construct autoPtr compound with forwarding arguments.
bool isNumber() const noexcept
Token is LABEL, FLOAT or DOUBLE.
compatibility name for DOUBLE
virtual void write(Ostream &os) const =0
Write the underlying content.
friend Ostream & operator<<(Ostream &os, const compound &ct)
Output operator.
bool isVerbatim() const noexcept
Token is VERBATIM string (string variant)
bool pending() const noexcept
Get compound pending-read status.
Hash - directive or start verbatim string.
virtual label size() const
The size of the underlying content.
bool isQuotedString() const noexcept
Token is (quoted) STRING (string variant)