ct_common  1.0.1
Common library for combinatorial testing
src/ct_common/common/constraint_s_binary.cpp
Go to the documentation of this file.
00001 //===----- ct_common/common/constraint_s_binary.cpp -------------*- C++ -*-===//
00002 //
00003 //                      The ct_common Library
00004 //
00005 // This file is distributed under the MIT license. See LICENSE for details.
00006 //
00007 //===----------------------------------------------------------------------===//
00008 //
00009 // This file contains the function definitions of class Constraint_S_Binary
00010 //
00011 //===----------------------------------------------------------------------===//
00012 
00013 #include <ct_common/common/constraint_s_binary.h>
00014 #include <ct_common/common/arithmetic_utils.h>
00015 #include <ct_common/common/eval_type_string.h>
00016 
00017 using namespace ct::common;
00018 
00019 Constraint_S_Binary::Constraint_S_Binary(void)
00020     : Constraint_S() {
00021   this->oprds_.resize(2);
00022 }
00023 
00024 Constraint_S_Binary::Constraint_S_Binary(const Constraint_S_Binary &from)
00025   : Constraint_S(from) {
00026 }
00027 
00028 Constraint_S_Binary &Constraint_S_Binary::operator = (
00029     const Constraint_S_Binary &right) {
00030   Constraint_S::operator=(right);
00031   return *this;
00032 }
00033 
00034 Constraint_S_Binary::~Constraint_S_Binary(void) {
00035 }
00036 
00037 std::string Constraint_S_Binary::get_class_name(void) const {
00038   return Constraint_S_Binary::class_name();
00039 }
00040 
00041 std::string Constraint_S_Binary::class_name(void) {
00042   return "Constraint_S_Binary";
00043 }
00044 
00045 EvalType_Bool Constraint_S_Binary::Evaluate( const std::vector<boost::shared_ptr<ParamSpec> > &param_specs,
00046                                 const Assignment &assignment) const {
00047   EvalType_Bool tmp_return;
00048   EvalType_String val_l = this->get_loprd()->Evaluate(param_specs, assignment);
00049   EvalType_String val_r = this->get_roprd()->Evaluate(param_specs, assignment);
00050   tmp_return.is_valid_ = val_l.is_valid_ && val_r.is_valid_;
00051   if (tmp_return.is_valid_) {
00052     tmp_return.value_ = this->evaluate_func(val_l.value_, val_r.value_);
00053   }
00054   return tmp_return;
00055 }
00056 
00057 void Constraint_S_Binary::dump(std::ostream &os, const std::vector<boost::shared_ptr<ParamSpec> > &param_specs) const {
00058   os << "(";
00059   this->get_loprd()->dump(os, param_specs);
00060   os << this->get_op_token();
00061   this->get_roprd()->dump(os, param_specs);
00062   os << ")";
00063 }
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines