1 #ifndef EXPR_Environment_H
2 #define EXPR_Environment_H
5 #include "EXPR_Object.h"
8 #include "EXPR_VariableNode.h"
11 #include "CORE_ClassFactory.h"
27 std::map<tString,CORE_SharedPointer<EXPR_VariableNode>> mVariables;
50 static inline CORE_UniquePointer<EXPR_Environment>
New() {
78 for(
const auto& var:mVariables) {
79 mem+=var.first.length()*
sizeof(tUChar);
80 mem+=var.second->getContentsMemorySize();
89 auto iter=mVariables.find(var);
90 if (iter!= mVariables.cend())
return (iter->second);
91 CORE_SharedPointer<EXPR_VariableNode> nullPtr;
99 auto iter=mVariables.find(var);
100 if (iter!= mVariables.cend())
return (iter->second.get());
108 auto iter=mVariables.find(var);
109 if (iter!= mVariables.cend())
return (iter->second.get());
118 inline void record(
const tString& varName,CORE_UniquePointer<EXPR_VariableNode> var) {
125 inline void record(
const tString& varName,CORE_SharedPointer<EXPR_VariableNode> var) {
126 mVariables[varName]=var;
134 inline void adimensionize(
const tReal& L,std::map<tString,tBoolean>& alreadyComputed) {
136 for(
auto& var:mVariables) {
137 node=(var.second)->getExpression();
154 for(
auto& var:mVariables) {
155 node=(var.second)->getExpression();
168 for(
auto& var:mVariables) {
169 ok=ok && ((var.second)->getExpression()!=
null);
178 std::stringstream sout;
180 for(
const auto& var:mVariables) {
181 node=(var.second)->getExpression();
183 if (node!=
null) sout<<node->
toString();
CORE_SharedPointer< T > NewSharedPointer() const
create a shared instance of a class with same type as T with no argument
Definition: CORE_ClassFactory.h:198
class Free introduced for deleting a smart pointer
Definition: CORE_Object.h:113
tString getIdentityString() const
retrun the string identification of the class
Definition: CORE_Object.h:321
This class is the environment with contains all the variable value.
Definition: EXPR_Environment.h:20
void computeBoundingBox(std::map< tString, tBoolean > &alreadyComputed)
compute the bounding box of the node
Definition: EXPR_Environment.h:151
void record(const tString &varName, CORE_UniquePointer< EXPR_VariableNode > var)
register the data of the variable
Definition: EXPR_Environment.h:118
EXPR_VariableNode * lookUp(const tString &var)
return the value of the variable as boolean
Definition: EXPR_Environment.h:107
static CORE_UniquePointer< EXPR_Environment > New()
crete the new instance of this
Definition: EXPR_Environment.h:50
EXPR_Environment()
create the class
Definition: EXPR_Environment.h:36
const EXPR_VariableNode * lookUp(const tString &var) const
return the value of the variable as boolean
Definition: EXPR_Environment.h:98
void record(const tString &varName, CORE_SharedPointer< EXPR_VariableNode > var)
register the data of the variable
Definition: EXPR_Environment.h:125
virtual ~EXPR_Environment()
delete the class
Definition: EXPR_Environment.h:42
tBoolean isConsistant() const
return true if all variables have expression
Definition: EXPR_Environment.h:166
virtual tMemSize getContentsMemorySize() const override
return nthe memory size of the included associations
Definition: EXPR_Environment.h:76
void adimensionize(const tReal &L, std::map< tString, tBoolean > &alreadyComputed)
adimensionize the node
Definition: EXPR_Environment.h:134
virtual tMemSize getMemorySize() const override
return the memory size of the class
Definition: EXPR_Environment.h:64
virtual tString toString() const override
return the string representation of this
Definition: EXPR_Environment.h:177
CORE_SharedPointer< EXPR_VariableNode > lookUpSharedPointer(const tString &var) const
return the value of the variable as boolean
Definition: EXPR_Environment.h:88
This class is the base class of all the parser package.
Definition: EXPR_Object.h:27
virtual tMemSize getContentsMemorySize() const override
return nthe memory size of the included associations
Definition: EXPR_Object.h:70
virtual void adimensionize(const tReal &L, std::map< tString, tBoolean > &alreadyComputed) override
adimensionize the node
Definition: EXPR_ParentNode.h:139
virtual tString toString() const override
return the string representation of this
Definition: EXPR_ParentNode.h:169
virtual void computeBoundingBox(std::map< tString, tBoolean > &alreadyComputed) override
compute the bounding box of the geometry after applying the transformation cosidering only first chil...
Definition: EXPR_ParentNode.cpp:30
This class describes the root of the tree.
Definition: EXPR_RootNode.h:16
This class describes a variable node with contains:
Definition: EXPR_VariableNode.h:17