00001 #ifndef INSTANCE_TREE_H_INCLUDED_
00002 #define INSTANCE_TREE_H_INCLUDED_
00003
00004 #include "rose.h"
00005
00006 #include <vector>
00007 #include <list>
00008 #include <utility>
00009
00010 namespace risc {
00011
00012 class Class;
00013 class Object;
00014
00015 class InstanceTree {
00016
00017 public:
00018 InstanceTree();
00019
00020 InstanceTree(const InstanceTree &other);
00021
00022 struct Element {
00023 Class* first;
00024 Object* second;
00025 int id;
00026
00027 Element(Class* first_, Object* second_, int id_ = 0):
00028 first(first_), second(second_), id(id_)
00029 { }
00030
00031 Element():
00032 first(NULL), second(NULL), id(0)
00033 { }
00034 };
00035
00036 typedef std::list<Element> Path;
00037
00044 InstanceTree get_real_mapped_variable();
00045
00050 std::list<InstanceTree> find_all_instances_of(SgVariableDefinition *var_def);
00051
00056 InstanceTree get_parent();
00057
00062 void print_instance_tree();
00063
00068 Class* get_scope();
00069
00074 Object* get_object();
00075
00080 SgVariableSymbol* get_object_symbol();
00081
00086 void get_all_ports(std::list<InstanceTree>& occurence);
00087
00092 void get_all_events(std::list<InstanceTree>& occurence);
00093
00098 Element pop_back();
00099
00104 void push_back(Element ohs);
00105
00106
00107 Path path_;
00108
00109 bool operator==(const InstanceTree &ohs);
00110
00111 private:
00117 void recursive_tree_walk(std::list<InstanceTree>& occurence,
00118 SgVariableDefinition *var_def);
00119
00126 SgVariableSymbol* get_mapped_reference(SgVariableSymbol* reference,
00127 SgClassDefinition *base_class_def,
00128 SgClassDefinition *parent_class_def,
00129 SgVariableDefinition *parent_member);
00130 };
00131
00132 }
00133
00134 #endif
00135
00136