Skip to content

Commit

Permalink
remove unused var in TVariableTable
Browse files Browse the repository at this point in the history
  • Loading branch information
tomwillow committed Sep 10, 2023
1 parent 8faf8c6 commit 6a3c9bd
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 14 deletions.
19 changes: 6 additions & 13 deletions Solver/TVariableTable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ using namespace std;
TVariableTable::TVariableTable()
{
bShared = false;
eError = ERROR_NO;
}


Expand All @@ -29,8 +28,7 @@ double TVariableTable::GetValueFromVarPoint(const std::string VarStr)
auto it = FindVariableTable(VarStr);
if (it == VariableTable.end())
{
eError = ERROR_UNDEFINED_VARIABLE;
throw TError{ eError, VarStr };
throw TError{ ERROR_UNDEFINED_VARIABLE, VarStr };
}
return VariableValue[it - VariableTable.begin()];
}
Expand All @@ -40,8 +38,7 @@ void TVariableTable::SetValueFromVarStr(std::string VarStr, double value)
auto it = FindVariableTable(VarStr);
if (it == VariableTable.end())
{
eError = ERROR_UNDEFINED_VARIABLE;
throw TError{ eError, VarStr };
throw TError{ ERROR_UNDEFINED_VARIABLE, VarStr };
}
VariableValue[it - VariableTable.begin()] = value;
}
Expand All @@ -61,8 +58,7 @@ void TVariableTable::RemoveOne(std::ostream *pStr, std::string var, bool bIgnore
return;
else
{
eError = ERROR_UNDEFINED_VARIABLE;
throw TError{ eError, var };
throw TError{ERROR_UNDEFINED_VARIABLE, var };
return;
}
}
Expand All @@ -84,8 +80,7 @@ void TVariableTable::DefineOne(std::ostream *pStr, std::string var, double value
{
if (!isLegalName(var))
{
eError = ERROR_INVALID_VARNAME;
throw TError{ eError, var };
throw TError{ ERROR_INVALID_VARNAME, var };
return;
}

Expand All @@ -99,8 +94,7 @@ void TVariableTable::DefineOne(std::ostream *pStr, std::string var, double value
}
else
{
eError = ERROR_VAR_HAS_BEEN_DEFINED;
throw TError{ eError, var };
throw TError{ ERROR_VAR_HAS_BEEN_DEFINED, var };
return;
}
}
Expand Down Expand Up @@ -137,8 +131,7 @@ void TVariableTable::Define(std::ostream *pStr, std::string input_str, std::stri
if (tempVar.size() != tempValue.size())
{
if (pStr != NULL) *pStr << TEXT("变量名与初始值数量不对等。");
eError = ERROR_VAR_COUNT_NOT_EQUAL_NUM_COUNT;
throw TError{ eError, "VAR:" + input_str + " VALUE:" + input_num };
throw TError{ ERROR_VAR_COUNT_NOT_EQUAL_NUM_COUNT, "VAR:" + input_str + " VALUE:" + input_num };
return;
}

Expand Down
1 change: 0 additions & 1 deletion Solver/TVariableTable.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ class TVariableTable
bool isLegalName(std::string s);
public:
bool bShared;//如果是共享变量表则不delete元素
enumError eError;
std::vector<std::string> VariableTable;
std::vector<double> VariableValue;
TVariableTable();
Expand Down

0 comments on commit 6a3c9bd

Please sign in to comment.