00001
00002
00003
00004
00005
00006
00007
00008 #ifndef CONSTANT_H_
00009 #define CONSTANT_H_
00010
00011 #include "Symbol.h"
00012 #include <string>
00013 using namespace std;
00014
00015
00016 namespace il{class const_expression;}
00017
00018 namespace sail {
00019
00023 class Constant:public Symbol {
00024
00025 friend class boost::serialization::access;
00026
00027 template<class Archive>
00028 void serialize(Archive & ar, const unsigned int version)
00029 {
00030 ar & boost::serialization::base_object<sail::Symbol>(*this);
00031 ar & constant_exp;
00032 ar & constant;
00033 ar & _is_signed;
00034 ar & size;
00035 }
00036
00037 private:
00038
00039
00040
00041
00042
00043 il::const_expression* constant_exp;
00044 long constant;
00045 bool _is_signed;
00046 short size;
00047
00048
00049 public:
00050 Constant(il::const_expression* constant_exp);
00051 Constant(long constant, bool is_signed, short size);
00052 Constant();
00053 virtual string to_string() const;
00054 virtual string to_string(bool print_original) const;
00055
00060 virtual il::node* get_original_node();
00061
00065 virtual bool is_constant();
00066
00070 virtual bool is_variable();
00071 virtual il::type* get_type();
00072
00076 bool is_integer();
00077
00081 bool is_string_constant();
00082
00083
00088 long int get_integer();
00089
00093 string get_string_constant();
00094
00098 bool is_signed();
00099
00103 int get_size();
00104 virtual ~Constant();
00105 };
00106
00107 }
00108
00109 #endif