ct_common  1.0.1
Common library for combinatorial testing
src/ct_common/common/exp_a_cast.cpp
Go to the documentation of this file.
00001 //===----- ct_common/common/exp_a_cast.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 Exp_A_Cast
00010 //
00011 //===----------------------------------------------------------------------===//
00012 
00013 #include <ct_common/common/exp_a_cast.h>
00014 
00015 using namespace ct::common;
00016 
00017 Exp_A_Cast::Exp_A_Cast(void)
00018   : Exp_A_Unary() {
00019 }
00020 
00021 Exp_A_Cast::Exp_A_Cast(const Exp_A_Cast &from)
00022   : Exp_A_Unary(from) {
00023 }
00024 
00025 Exp_A_Cast& Exp_A_Cast::operator = (const Exp_A_Cast &right) {
00026   Exp_A_Unary::operator=(right);
00027   return *this;
00028 }
00029 
00030 Exp_A_Cast::~Exp_A_Cast(void) {
00031 }
00032 
00033 std::string Exp_A_Cast::get_class_name(void) const {
00034   return Exp_A_Cast::class_name();
00035 }
00036 
00037 std::string Exp_A_Cast::class_name(void) {
00038   return "Exp_A_Cast";
00039 }
00040 
00041 double Exp_A_Cast::evaluate_double(double val) const {
00042   return val;
00043 }
00044 
00045 int Exp_A_Cast::evaluate_int(int val) const {
00046   return val;
00047 }
00048 
00049 std::string Exp_A_Cast::get_op_token(void) const {
00050   switch (this->type_) {
00051   case EAT_INT:
00052     return "int";
00053     break;
00054   case EAT_DOUBLE:
00055     return "double";
00056     break;
00057   default:
00058     CT_EXCEPTION("unknown cast type");
00059     break;
00060   }
00061   return "";
00062 }
00063 
00064 
00065 void Exp_A_Cast::dump(std::ostream &os, const std::vector<boost::shared_ptr<ParamSpec> > &param_specs) const {
00066   os << this->get_op_token();
00067   os << "(";
00068   this->get_oprd()->dump(os, param_specs);
00069   os << ")";
00070 }
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines