diff options
author | Tim King <taking@cs.nyu.edu> | 2017-10-17 16:01:21 -0700 |
---|---|---|
committer | Mathias Preiner <mathias.preiner@gmail.com> | 2017-10-17 16:01:21 -0700 |
commit | 382813c77025e05550876bf02f2782b72d6c8927 (patch) | |
tree | 637b4ef538215a490c6bc28ad7dc82bee686ff80 /src/smt/command.cpp | |
parent | 27dac5e91eee563d62795e43d5e7ac5f6c878730 (diff) |
Making the values argument const in the SetUserAttributeCommand const… (#1249)
* Making the values argument const in the SetUserAttributeCommand constructor. Misc. cleanup of SetUserAttributeCommand.
* Removing override keyword that was making SWIG unhappy.
Diffstat (limited to 'src/smt/command.cpp')
-rw-r--r-- | src/smt/command.cpp | 53 |
1 files changed, 28 insertions, 25 deletions
diff --git a/src/smt/command.cpp b/src/smt/command.cpp index 82b494382..8012c868c 100644 --- a/src/smt/command.cpp +++ b/src/smt/command.cpp @@ -850,43 +850,46 @@ Command* DefineNamedFunctionCommand::clone() const { /* class SetUserAttribute */ -SetUserAttributeCommand::SetUserAttributeCommand( const std::string& attr, Expr expr ) throw() : - d_attr( attr ), d_expr( expr ){ -} - -SetUserAttributeCommand::SetUserAttributeCommand( const std::string& attr, Expr expr, - std::vector<Expr>& values ) throw() : - d_attr( attr ), d_expr( expr ){ - d_expr_values.insert( d_expr_values.begin(), values.begin(), values.end() ); -} - -SetUserAttributeCommand::SetUserAttributeCommand( const std::string& attr, Expr expr, - const std::string& value ) throw() : - d_attr( attr ), d_expr( expr ), d_str_value( value ){ -} +SetUserAttributeCommand::SetUserAttributeCommand( + const std::string& attr, Expr expr, const std::vector<Expr>& expr_values, + const std::string& str_value) throw() + : d_attr(attr), + d_expr(expr), + d_expr_values(expr_values), + d_str_value(str_value) {} + +SetUserAttributeCommand::SetUserAttributeCommand(const std::string& attr, + Expr expr) throw() + : SetUserAttributeCommand(attr, expr, {}, "") {} + +SetUserAttributeCommand::SetUserAttributeCommand( + const std::string& attr, Expr expr, const std::vector<Expr>& values) throw() + : SetUserAttributeCommand(attr, expr, values, "") {} + +SetUserAttributeCommand::SetUserAttributeCommand( + const std::string& attr, Expr expr, const std::string& value) throw() + : SetUserAttributeCommand(attr, expr, {}, value) {} void SetUserAttributeCommand::invoke(SmtEngine* smtEngine) { try { - if(!d_expr.isNull()) { - smtEngine->setUserAttribute( d_attr, d_expr, d_expr_values, d_str_value ); + if (!d_expr.isNull()) { + smtEngine->setUserAttribute(d_attr, d_expr, d_expr_values, d_str_value); } d_commandStatus = CommandSuccess::instance(); - } catch(exception& e) { + } catch (exception& e) { d_commandStatus = new CommandFailure(e.what()); } } -Command* SetUserAttributeCommand::exportTo(ExprManager* exprManager, ExprManagerMapCollection& variableMap){ +Command* SetUserAttributeCommand::exportTo( + ExprManager* exprManager, ExprManagerMapCollection& variableMap) { Expr expr = d_expr.exportTo(exprManager, variableMap); - SetUserAttributeCommand * c = new SetUserAttributeCommand( d_attr, expr, d_str_value ); - c->d_expr_values.insert( c->d_expr_values.end(), d_expr_values.begin(), d_expr_values.end() ); - return c; + return new SetUserAttributeCommand(d_attr, expr, d_expr_values, d_str_value); } -Command* SetUserAttributeCommand::clone() const{ - SetUserAttributeCommand * c = new SetUserAttributeCommand( d_attr, d_expr, d_str_value ); - c->d_expr_values.insert( c->d_expr_values.end(), d_expr_values.begin(), d_expr_values.end() ); - return c; +Command* SetUserAttributeCommand::clone() const { + return new SetUserAttributeCommand(d_attr, d_expr, d_expr_values, + d_str_value); } std::string SetUserAttributeCommand::getCommandName() const throw() { |