ct_common  1.0.1
Common library for combinatorial testing
src/ct_common/common/exp_a_unary.h
Go to the documentation of this file.
00001 //===----- ct_common/common/exp_a_unary.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 unary expressions
00010 //
00011 //===----------------------------------------------------------------------===//
00012 
00013 #ifndef CT_COMMON_EXP_A_UNARY_H_
00014 #define CT_COMMON_EXP_A_UNARY_H_
00015 
00016 #include <boost/shared_ptr.hpp>
00017 #include <ct_common/common/utils.h>
00018 #include <ct_common/common/exp_a.h>
00019 
00020 namespace ct {
00021 namespace common {
00025 class DLL_EXPORT Exp_A_Unary : public Exp_A {
00026 public:
00027   Exp_A_Unary(void);
00028   Exp_A_Unary(const Exp_A_Unary &from);
00029   Exp_A_Unary &operator = (const Exp_A_Unary &right);
00030   virtual ~Exp_A_Unary(void) = 0;
00031 
00032 public:
00033   virtual std::string get_class_name(void) const;
00034   static std::string class_name(void);
00035   virtual void dump(std::ostream &os, const std::vector<boost::shared_ptr<ParamSpec> > &param_specs) const;
00037   virtual std::string get_op_token(void) const = 0;
00038 
00039 public:
00040   boost::shared_ptr<const Exp_A> get_oprd(void) const { return boost::dynamic_pointer_cast<Exp_A>(this->oprds_[0]); }
00041 
00042   void set_oprd(const boost::shared_ptr<TreeNode> &oprd) { this->oprds_[0] = oprd; }
00043 
00044 private:
00045   virtual EvalType_Double EvaluateDouble_Impl( const std::vector<boost::shared_ptr<ParamSpec> > &param_specs,
00046                                       const Assignment &assignment) const;
00047 
00048   virtual EvalType_Int EvaluateInt_Impl( const std::vector<boost::shared_ptr<ParamSpec> > &param_specs,
00049                                 const Assignment &assignment) const;
00050 
00051 private:
00053   virtual double evaluate_double(double val) const = 0;
00055   virtual int evaluate_int(int val) const = 0;
00056 };
00057 }  // namespace common
00058 }  // namespace ct
00059 
00060 #endif  // CT_COMMON_EXP_A_UNARY_H_
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines