00001 #ifndef witness_VISITOR_DOT_GUARD 00002 #define witness_VISITOR_DOT_GUARD 1 00003 00004 /** 00005 * @author Nicholas Kidd 00006 */ 00007 00008 #include "wali/Common.hpp" 00009 #include "wali/ref_ptr.hpp" 00010 #include "wali/witness/Witness.hpp" 00011 #include "wali/witness/Visitor.hpp" 00012 #include <iostream> 00013 #include <string> 00014 00015 namespace wali 00016 { 00017 namespace witness 00018 { 00019 /** 00020 * @class VisitorDot 00021 */ 00022 class VisitorDot : public Visitor 00023 { 00024 public: 00025 VisitorDot( std::ostream& o ); 00026 00027 virtual ~VisitorDot(); 00028 virtual bool visit( Witness * w ); 00029 virtual bool visitExtend( WitnessExtend * w ); 00030 virtual bool visitCombine( WitnessCombine * w ); 00031 virtual bool visitRule( WitnessRule * w ); 00032 virtual bool visitTrans( WitnessTrans * w ); 00033 virtual bool visitMerge( WitnessMerge * w ); 00034 00035 // 00036 // Helper functions for printing in Witness nodes 00037 // in dotty format 00038 // 00039 void printNodeName( Witness * w ); 00040 00041 void printEdge( Witness * head, Witness * tail ); 00042 00043 void printNode( Witness * w, std::string color ); 00044 00045 void printNode( Witness * w, std::string color, std::string label ); 00046 00047 void printNodeName( witness_t& wit ) { 00048 printNodeName( wit.get_ptr() ); 00049 } 00050 void printEdge( witness_t& h,witness_t& t ) { 00051 printEdge(h.get_ptr(),t.get_ptr()); 00052 } 00053 void printNode( witness_t& w,std::string color ) { 00054 printNode( w.get_ptr(),color ); 00055 } 00056 protected: 00057 std::ostream& os; 00058 00059 }; // class VisitorDot 00060 00061 } // namespace witness 00062 00063 } // namespace wali 00064 00065 #endif // witness_VISITOR_DOT_GUARD 00066