Main Page | Class Hierarchy | Data Structures | File List | Data Fields | Globals

View.hpp

Go to the documentation of this file.
00001 // vim:sw=2:ts=8
00017 #ifndef VIEW_HPP
00018 #define VIEW_HPP
00019 
00020 #include <map>
00021 #include "Hierarchy.hpp"
00022 #include "Subject.hpp"
00023 #include "Observer.hpp"
00024 #include "GraphException.hpp"
00025 
00026 
00027 namespace gns {
00028 
00029   class Subject;
00030 
00072   class View : public ConstGraph, public Subject, public Observer
00073   {
00074     private:
00076       std::map<Node, Node> *hierarchynodes;
00078       std::map<Node, Node> *viewnodes;
00080       Hierarchy *hierarchy;
00082       bool own_hierarchy;
00083 
00084 
00086       void init(Hierarchy *h, PropertyFacility *p, int init_mode);
00087 
00088 
00089     public:
00090         const static int INIT_TOP = 1;    
00091         const static int INIT_BOTTOM = 2  ;
00092 
00094         View();
00096         View(Hierarchy *h, int init_mode = INIT_TOP, PropertyFacility *p = NULL);
00098         View(const View &v);
00099 
00101         virtual ~View();
00102 
00103         using ConstGraph::node_id;
00104         using ConstGraph::edge_id;
00105 
00107         virtual void node_id(Node n, NodeID id);
00108 
00110         virtual void edge_id(Edge e, EdgeID id);
00111 
00113         void update(Subject *sub, long msg, Item item);
00114 
00116         void expand(Node node);
00117 
00119         void collapse(Node node);
00120 
00122         Node hierarchy_node(const Node node) const;
00123 
00125         Node view_node(const Node node) const;
00126 
00128         Hierarchy* get_hierarchy() const;
00129 
00131         void set_hierarchy(Hierarchy *h, int init_mode = INIT_TOP);
00132 
00133     private:
00139         void get_graph_childs(Node parent, std::vector<Node>* nlist, bool do_ignore_node, Node ignore_node, bool do_ignore_edge, Edge ignore_edge);
00140 
00146         void add_node_edges(Node node, bool do_ignore_node, Node ignore_node, bool do_ignore_edge, Edge ignore_edge);
00147 
00149         void new_node_update(Subject *sub, Node node);
00150 
00152         void del_node_update(Subject *sub, Node node);
00153 
00155         void new_edge_update(Subject *sub, Edge edge);
00156 
00158         void del_edge_update(Subject *sub, Edge edge);
00159   };
00160 
00161   
00162 }
00163 
00164 #endif

Generated on Sun Nov 5 12:05:19 2006 for Graph by  doxygen 1.4.1