00001 #ifndef __tree_node_h__ 00002 #define __tree_node_h__ 00003 00004 #include "cmt_std.h" 00005 #include "cmt_system.h" 00006 #include "cmt_awk.h" 00007 00008 class Package; 00009 00017 class tree_node 00018 { 00019 public: 00020 static tree_node& null (); 00021 00022 public: 00023 00025 tree_node (); 00026 00028 tree_node (tree_node* node, Package* p); 00029 void set (tree_node* node, Package* p); 00030 Package* get_package () const; 00031 const cmt_string& get_name () const; 00032 const cmt_string& get_dot_name () const; 00033 const cmt_string& get_cluster_name () const; 00034 const cmt_string& get_dot_label () const; 00035 int operator == (const tree_node& other) const; 00036 int operator == (const Package& p) const; 00037 int operator != (const tree_node& other) const; 00038 tree_node* get_last_sub_node () const; 00039 void install_as_reference_node (); 00040 void set_cyclic (); 00041 bool is_cyclic () const; 00042 00046 tree_node& append (Package& p); 00047 00051 bool hold_package (const Package& p) const; 00052 bool check_cycle (const Package& p) const; 00053 00058 tree_node* references (const tree_node& other) const; 00059 00066 void reduce (); 00067 00069 int show_node (cmt_string& output, 00070 const cmt_string& direction, 00071 bool collapsed = false) const; 00072 00074 int show_tree (cmt_string& output, 00075 const cmt_string& direction, 00076 bool collapsed = false) const; 00077 00078 private: 00079 cmt_vectorsub_nodes; 00080 cmt_vector cyclic_nodes; 00081 tree_node* parent; 00082 Package* package; 00083 bool cyclic; 00084 bool discarded; // After reduction 00085 }; 00086 00087 #endif 00088 00089 00090 00091 00092 00093 00094 00095