ct_common  1.0.1
Common library for combinatorial testing
src/ct_common/common/constraint_l_binary.h
Go to the documentation of this file.
00001 //===----- ct_common/common/constraint_l_binary.h ---------------*- 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 header file contains the base class for binary logical constraints
00010 //
00011 //===----------------------------------------------------------------------===//
00012 
00013 #ifndef CT_COMMON_CONSTRAINT_L_BINARY_H_
00014 #define CT_COMMON_CONSTRAINT_L_BINARY_H_
00015 
00016 #include <boost/shared_ptr.hpp>
00017 #include <ct_common/common/utils.h>
00018 #include <ct_common/common/constraint_l.h>
00019 
00020 namespace ct {
00021 namespace common {
00025 class DLL_EXPORT Constraint_L_Binary : public Constraint_L {
00026 public:
00027   Constraint_L_Binary(void);
00028   Constraint_L_Binary(const Constraint_L_Binary &from);
00029   Constraint_L_Binary &operator = (const Constraint_L_Binary &right);
00030   virtual ~Constraint_L_Binary(void);
00031 
00032   virtual std::string get_class_name(void) const;
00033   static std::string class_name(void);
00034   virtual void dump(std::ostream &os, const std::vector<boost::shared_ptr<ParamSpec> > &param_specs) const;
00036   virtual std::string get_op_token(void) const = 0;
00037 
00038   boost::shared_ptr<const Constraint> get_loprd(void) const { return boost::dynamic_pointer_cast<Constraint>(this->oprds_[0]); }
00039   boost::shared_ptr<const Constraint> get_roprd(void) const { return boost::dynamic_pointer_cast<Constraint>(this->oprds_[1]); }
00040 
00041   void set_loprd(const boost::shared_ptr<TreeNode> &loprd) { this->oprds_[0] = loprd; }
00042   void set_roprd(const boost::shared_ptr<TreeNode> &roprd) { this->oprds_[1] = roprd; }
00043 
00044   virtual EvalType_Bool Evaluate(const std::vector<boost::shared_ptr<ParamSpec> > &param_specs,
00045                         const Assignment &assignment) const;
00046 
00047 private:
00049   virtual EvalType_Bool evaluate_func(EvalType_Bool val_l, EvalType_Bool val_r) const = 0;
00050 };
00051 }  // namespace common
00052 }  // namespace ct
00053 
00054 #endif  // CT_COMMON_CONSTRAINT_L_BINARY_H_
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines