00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 #ifndef SAIL_CAST_H_
00011 #define SAIL_CAST_H_
00012
00013 #include "SaveInstruction.h"
00014
00015 #include <string>
00016 using namespace std;
00017
00018 #include "type.h"
00019
00020 namespace il{class node;}
00021 namespace sail {
00022
00023 class Variable;
00024 class Symbol;
00025
00029 class Cast:public SaveInstruction {
00030 friend class boost::serialization::access;
00031
00032 template<class Archive>
00033 void save(Archive & ar, const unsigned int version) const
00034 {
00035 ar & boost::serialization::base_object<sail::SaveInstruction>(*this);
00036 ar & v;
00037 ar & s;
00038 ar & t;
00039 }
00040
00041 template<class Archive>
00042 void load(Archive & ar, const unsigned int version)
00043 {
00044 ar & boost::serialization::base_object<sail::SaveInstruction>(*this);
00045 ar & v;
00046 ar & s;
00047 ar & t;
00048 il::type::register_loaded_typeref(&t);
00049 }
00050
00051 BOOST_SERIALIZATION_SPLIT_MEMBER()
00052 private:
00053 Variable* v;
00054 Symbol* s;
00055 il::type* t;
00056
00057 public:
00058 Cast(Variable* v, Symbol* s, il::type* t, il::node* original, int line);
00059 Cast(){};
00060 virtual string to_string() const;
00061 virtual string to_string(bool pretty_print) const;
00062 virtual Variable* get_lhs();
00063 virtual void set_lhs(Variable* v);
00064 Symbol* get_rhs();
00065
00070 il::type* get_cast_type();
00071 virtual bool is_removable();
00072 virtual ~Cast();
00073 };
00074
00075 }
00076
00077 #endif