# PhasicFlow: src/phasicFlow/types/basicTypes/Logical.hpp Source File

Logical.hpp
Go to the documentation of this file.
/*------------------------------- phasicFlow ---------------------------------
O C enter of
O O E ngineering and
O O M ultiscale modeling of
OOOOOOO F luid flow
------------------------------------------------------------------------------
Copyright (C): www.cemf.ir
email: hamid.r.norouzi AT gmail.com
------------------------------------------------------------------------------
Licence:
This file is part of phasicFlow code. It is a free software for simulating
granular and multiphase flows. You can redistribute it and/or modify it under
the terms of GNU General Public License v3 or any other later versions.
phasicFlow is distributed to help others in their research in the field of
granular and multiphase flows, but WITHOUT ANY WARRANTY; without even the
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-----------------------------------------------------------------------------*/
#ifndef __Logical_hpp__
#define __Logical_hpp__
#include "builtinTypes.hpp"
#include "bTypesFunctions.hpp"
#include "typeInfo.hpp"
namespace pFlow
{
class iIstream;
class iOstream;
// allias for bool
class Logical
{
protected:
bool s_ = false;
int yesNoSet_ = 0;
inline static const word YesNo__[4][2] = {{"Yes", "No"},{"on","off"},{"true","false"}, {"Ok","No"}};
inline explicit Logical(bool s, int yns)
:
s_(s),
yesNoSet_(yns)
{}
public:
TypeInfoNV("Logical");
inline Logical(){}
inline explicit Logical(bool s)
:
s_(s),
yesNoSet_(0)
{}
Logical(const word& l);
Logical(const char* ch);
Logical(const Logical&) = default;
Logical(Logical&&) = default;
Logical& operator=(const Logical&) = default;
Logical& operator=(Logical&&) = default;
inline Logical& operator=(const bool& b)
{
s_ = b;
yesNoSet_ = 0;
return *this;
}
inline bool operator()() const
{
return s_;
}
inline explicit operator bool() const
{
return s_;
}
inline Logical operator!()const
{
return Logical(!s_, yesNoSet_);
}
bool read(iIstream& is);
bool write(iOstream& os)const;
bool static evaluteWord(const word& l, bool& b, int& yesNoSet );
};
iIstream& operator>>( iIstream& is, Logical& L);
iOstream& operator<<( iOstream& os, const Logical& L);
} // pFlow
#endif // __Logical_hpp__
pFlow::Logical::evaluteWord
static bool evaluteWord(const word &l, bool &b, int &yesNoSet)
Definition: Logical.cpp:42
pFlow::Logical::YesNo__
static const word YesNo__[4][2]
Definition: Logical.hpp:42
pFlow::Logical::operator=
Logical & operator=(const Logical &)=default
pFlow::Logical::Logical
Logical()
Definition: Logical.hpp:55
pFlow::word
std::string word
Definition: builtinTypes.hpp:63
pFlow::Logical::TypeInfoNV
TypeInfoNV("Logical")
pFlow
Definition: demComponent.hpp:28
pFlow::Logical::write
bool write(iOstream &os) const
Definition: Logical.cpp:98
pFlow::iIstream
Definition: iIstream.hpp:33
pFlow::Logical::read
bool read(iIstream &is)
Definition: Logical.cpp:65
pFlow::Logical::s_
bool s_
Definition: Logical.hpp:38
pFlow::operator>>
INLINE_FUNCTION iIstream & operator>>(iIstream &str, AB3History &ab3)
Definition: AdamsBashforth3.hpp:41
pFlow::operator<<
INLINE_FUNCTION iOstream & operator<<(iOstream &str, const AB3History &ab3)
Definition: AdamsBashforth3.hpp:57
pFlow::Logical::operator()
bool operator()() const
Definition: Logical.hpp:83
pFlow::Logical::Logical
Logical(bool s)
Definition: Logical.hpp:58
pFlow::Logical::operator=
Logical & operator=(const bool &b)
Definition: Logical.hpp:76
pFlow::Logical
Definition: Logical.hpp:35
pFlow::Logical::Logical
Logical(bool s, int yns)
Definition: Logical.hpp:44
pFlow::Logical::operator!
Logical operator!() const
Definition: Logical.hpp:93
typeInfo.hpp
builtinTypes.hpp
bTypesFunctions.hpp
pFlow::Logical::yesNoSet_
int yesNoSet_
Definition: Logical.hpp:40
pFlow::iOstream
Definition: iOstream.hpp:53