00001
00002
00003
00004
00005
00006
00007
00008 #ifndef IDENTIFIER_H_
00009 #define IDENTIFIER_H_
00010
00011
00012 #include <boost/serialization/vector.hpp>
00013 #include <boost/serialization/map.hpp>
00014 #include <boost/serialization/list.hpp>
00015 #include <boost/serialization/string.hpp>
00016 #include <boost/serialization/version.hpp>
00017 #include <boost/serialization/split_member.hpp>
00018 #include <boost/serialization/shared_ptr.hpp>
00019 #include <boost/serialization/base_object.hpp>
00020 #include <boost/serialization/export.hpp>
00021 #include <boost/serialization/set.hpp>
00022
00023 #include "FileIdentifier.h"
00024 #include "type.h"
00025 #include "namespace_context.h"
00026 #include "language.h"
00027
00028 #include <string>
00029
00030 using namespace std;
00031
00032 namespace il{
00033 class function_type;
00034 };
00035
00036
00037
00038
00039 class Identifier
00040 {
00041 friend class boost::serialization::access;
00042
00043 template<class Archive>
00044 void save(Archive & ar, const unsigned int version) const
00045 {
00046 ar & dir;
00047 ar & function_name;
00048 ar & loop_id;
00049 ar & signature;
00050 ar & ns;
00051 ar & language;
00052
00053 }
00054
00055 template<class Archive>
00056 void load(Archive & ar, const unsigned int version)
00057 {
00058 ar & dir;
00059 ar & function_name;
00060 ar & loop_id;
00061 ar & signature;
00062 il::type::register_loaded_typeref((il::type**)&signature);
00063 ar & ns;
00064 ar & language;
00065 }
00066
00067 BOOST_SERIALIZATION_SPLIT_MEMBER()
00068
00069
00070
00071
00072 private:
00073 FileIdentifier dir;
00074 string function_name;
00075 int loop_id;
00076 il::function_type* signature;
00077 il::namespace_context ns;
00078 language_type language;
00079 protected:
00080
00081 public:
00082 Identifier()
00083 {
00084 loop_id = 0;
00085 signature = NULL;
00086 language = LANG_UNSUPPORTED;
00087 };
00088
00089
00090
00091 Identifier(const FileIdentifier& dir, const string & function_name,
00092 const il::namespace_context & ns, il::function_type* signature,
00093 language_type language);
00094
00095
00096
00097
00098 Identifier(const Identifier& enclosing_fun_id, int loop_id);
00099
00100 Identifier(const Identifier& other);
00101
00102 string to_string(char dir_separator = '/') const;
00103 bool operator==(const Identifier & other) const;
00104 bool operator<(const Identifier & other) const;
00105 const string& get_function_name() const;
00106 const il::namespace_context& get_namespace() const;
00107 il::function_type* get_function_signature() const;
00108 Identifier get_function_identifier() const;
00109 const FileIdentifier& get_file_id() const;
00110 language_type get_language() const;
00111 bool is_loop_id() const;
00112 bool is_function_id() const;
00113 int get_loop_id() const;
00114 bool is_empty() const;
00115
00116
00117
00118 friend ostream& operator <<(ostream &os, const Identifier &obj);
00119
00120 virtual ~Identifier();
00121 };
00122
00123 ostream& operator <<(ostream &os, const Identifier &obj);
00124
00125 #endif