-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5452b00
commit cf6561d
Showing
65 changed files
with
1,556 additions
and
123 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,201 @@ | ||
/******************************************************************************* | ||
This file is part of Set--Based Graph Library. | ||
SBG Library is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU General Public License as published by | ||
the Free Software Foundation, either version 3 of the License, or | ||
(at your option) any later version. | ||
SBG Library is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU General Public License for more details. | ||
You should have received a copy of the GNU General Public License | ||
along with SBG Library. If not, see <http://www.gnu.org/licenses/>. | ||
******************************************************************************/ | ||
|
||
#include "eval/visitors/eval_base_dsbg.hpp" | ||
|
||
namespace SBG { | ||
|
||
namespace Eval { | ||
|
||
EvalBaseDSBG::EvalBaseDSBG() : env_() {} | ||
EvalBaseDSBG::EvalBaseDSBG(VarEnv env) : env_(env) {} | ||
|
||
LIB::BaseDSBG EvalBaseDSBG::operator()(AST::Natural v) const | ||
{ | ||
Util::ERROR("EvalBaseDSBG: trying to evaluate a Natural"); | ||
return LIB::BaseDSBG(); | ||
} | ||
|
||
LIB::BaseDSBG EvalBaseDSBG::operator()(AST::MDNatural v) const | ||
{ | ||
Util::ERROR("EvalBaseDSBG: trying to evaluate a MDNatural"); | ||
return LIB::BaseDSBG(); | ||
} | ||
|
||
LIB::BaseDSBG EvalBaseDSBG::operator()(AST::Rational v) const | ||
{ | ||
Util::ERROR("EvalBaseDSBG: trying to evaluate a Rational"); | ||
return LIB::BaseDSBG(); | ||
} | ||
|
||
LIB::BaseDSBG EvalBaseDSBG::operator()(AST::Boolean v) const | ||
{ | ||
Util::ERROR("EvalBaseDSBG: trying to evaluate a Boolean"); | ||
return LIB::BaseDSBG(); | ||
} | ||
|
||
LIB::BaseDSBG EvalBaseDSBG::operator()(Util::VariableName v) const | ||
{ | ||
MaybeEBT v_opt = env_[v]; | ||
if (v_opt) { | ||
ExprBaseType value = *v_opt; | ||
if (is<LIB::BaseDSBG>(value)) | ||
return boost::get<LIB::BaseDSBG>(value); | ||
|
||
else { | ||
Util::ERROR("EvalBaseDSBG: variable %s is not a PWMap", v.c_str()); | ||
return LIB::BaseDSBG(); | ||
} | ||
} | ||
|
||
Util::ERROR("EvalBaseDSBG: variable %s not defined", v.c_str()); | ||
return LIB::BaseDSBG(); | ||
} | ||
|
||
LIB::BaseDSBG EvalBaseDSBG::operator()(AST::UnaryOp v) const | ||
{ | ||
Util::ERROR("EvalBaseDSBG: trying to evaluate an arithmetic BinOp"); | ||
return LIB::BaseDSBG(); | ||
} | ||
|
||
LIB::BaseDSBG EvalBaseDSBG::operator()(AST::BinOp v) const | ||
{ | ||
Util::ERROR("EvalBaseDSBG: trying to evaluate an arithmetic BinOp"); | ||
return LIB::BaseDSBG(); | ||
} | ||
|
||
LIB::BaseDSBG EvalBaseDSBG::operator()(AST::Call v) const | ||
{ | ||
Util::ERROR("EvalBaseDSBG: trying to evaluate a Call"); | ||
return LIB::BaseDSBG(); | ||
} | ||
|
||
LIB::BaseDSBG EvalBaseDSBG::operator()(AST::Interval v) const | ||
{ | ||
Util::ERROR("EvalBaseDSBG: trying to evaluate an Interval"); | ||
return LIB::BaseDSBG(); | ||
} | ||
|
||
LIB::BaseDSBG EvalBaseDSBG::operator()(AST::InterUnaryOp v) const | ||
{ | ||
Util::ERROR("EvalBaseDSBG: trying to evaluate an InterUnaryOp"); | ||
return LIB::BaseDSBG(); | ||
} | ||
|
||
LIB::BaseDSBG EvalBaseDSBG::operator()(AST::InterBinOp v) const | ||
{ | ||
Util::ERROR("EvalBaseDSBG: trying to evaluate an InterBinOp"); | ||
return LIB::BaseDSBG(); | ||
} | ||
|
||
LIB::BaseDSBG EvalBaseDSBG::operator()(AST::MultiDimInter v) const | ||
{ | ||
Util::ERROR("EvalBaseDSBG: trying to evaluate an MultiDimInter"); | ||
return LIB::BaseDSBG(); | ||
} | ||
|
||
LIB::BaseDSBG EvalBaseDSBG::operator()(AST::MDInterUnaryOp v) const | ||
{ | ||
Util::ERROR("EvalBaseDSBG: trying to evaluate an MDInterUnaryOp"); | ||
return LIB::BaseDSBG(); | ||
} | ||
|
||
LIB::BaseDSBG EvalBaseDSBG::operator()(AST::MDInterBinOp v) const | ||
{ | ||
Util::ERROR("EvalBaseDSBG: trying to evaluate an MDInterBinOp"); | ||
return LIB::BaseDSBG(); | ||
} | ||
|
||
LIB::BaseDSBG EvalBaseDSBG::operator()(AST::Set v) const | ||
{ | ||
Util::ERROR("EvalBaseDSBG: trying to evaluate a Set"); | ||
return LIB::BaseDSBG(); | ||
} | ||
|
||
LIB::BaseDSBG EvalBaseDSBG::operator()(AST::SetUnaryOp v) const | ||
{ | ||
Util::ERROR("EvalBaseDSBG: trying to evaluate a SetUnaryOp"); | ||
return LIB::BaseDSBG(); | ||
} | ||
|
||
LIB::BaseDSBG EvalBaseDSBG::operator()(AST::SetBinOp v) const | ||
{ | ||
Util::ERROR("EvalBaseDSBG: trying to evaluate a SetBinOp"); | ||
return LIB::BaseDSBG(); | ||
} | ||
|
||
LIB::BaseDSBG EvalBaseDSBG::operator()(AST::LinearExp v) const | ||
{ | ||
Util::ERROR("EvalBaseDSBG: trying to evaluate a LinearExp"); | ||
return LIB::BaseDSBG(); | ||
} | ||
|
||
LIB::BaseDSBG EvalBaseDSBG::operator()(AST::LExpBinOp v) const | ||
{ | ||
Util::ERROR("EvalBaseDSBG: trying to evaluate a LExpBinOp"); | ||
return LIB::BaseDSBG(); | ||
} | ||
|
||
LIB::BaseDSBG EvalBaseDSBG::operator()(AST::MDLExp v) const | ||
{ | ||
Util::ERROR("EvalBaseDSBG: trying to evaluate a MDLExp"); | ||
return LIB::BaseDSBG(); | ||
} | ||
|
||
LIB::BaseDSBG EvalBaseDSBG::operator()(AST::MDLExpBinOp v) const | ||
{ | ||
Util::ERROR("EvalBaseDSBG: trying to evaluate a MDLExpBinOp"); | ||
return LIB::BaseDSBG(); | ||
} | ||
|
||
LIB::BaseDSBG EvalBaseDSBG::operator()(AST::LinearMap v) const | ||
{ | ||
Util::ERROR("EvalBaseDSBG: trying to evaluate a LinearMap"); | ||
return LIB::BaseDSBG(); | ||
} | ||
|
||
LIB::BaseDSBG EvalBaseDSBG::operator()(AST::PWLMap v) const | ||
{ | ||
Util::ERROR("EvalBaseDSBG: trying to evaluate a PWLMap"); | ||
return LIB::BaseDSBG(); | ||
} | ||
|
||
LIB::BaseDSBG EvalBaseDSBG::operator()(AST::SBG v) const | ||
{ | ||
Util::ERROR("EvalBaseDSBG: trying to evaluate a SBG"); | ||
return LIB::BaseDSBG(); | ||
} | ||
|
||
LIB::BaseDSBG EvalBaseDSBG::operator()(AST::DSBG v) const | ||
{ | ||
EvalUnordSet visit_set(env_); | ||
EvalBasePWMap visit_pw(env_); | ||
|
||
LIB::UnordSet V = Apply(visit_set, v.V()); | ||
LIB::BasePWMap Vmap = Apply(visit_pw, v.Vmap()); | ||
LIB::BasePWMap mapB = Apply(visit_pw, v.mapB()); | ||
LIB::BasePWMap mapD = Apply(visit_pw, v.mapD()); | ||
LIB::BasePWMap Emap = Apply(visit_pw, v.Emap()); | ||
|
||
return LIB::BaseDSBG(V, Vmap, mapB, mapD, Emap); | ||
} | ||
|
||
} // namespace Eval | ||
|
||
} // namespace SBG |
Oops, something went wrong.