00001 #ifndef _STR_GraphVizVisitor_H_ // -*-mode: c++; c-file-style: "gmtellemtel";-*-
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifdef __GNUG__
00022 # pragma interface
00023 #endif
00024
00025
00026
00027
00028
00029 #include <StrMod/UseTrackingVisitor.h>
00030 #include <set>
00031 #include <utility>
00032
00033 #define _STR_GraphVizVisitor_H_
00034
00035 namespace strmod {
00036 namespace strmod {
00037
00038 class BufferChunk;
00039
00040
00041
00042
00043
00044 class GraphVizVisitor : public UseTrackingVisitor
00045 {
00046 public:
00047 static const STR_ClassIdent identifier;
00048
00049
00050 GraphVizVisitor() : out_(0) { }
00051
00052 virtual ~GraphVizVisitor() { }
00053
00054 virtual int AreYouA(const lcore::ClassIdent &cid) const {
00055 return((identifier == cid) || UseTrackingVisitor::AreYouA(cid));
00056 }
00057
00058
00059
00060
00061
00062 const StrChunkPtr visit(const StrChunkPtr &root, std::ostream &out);
00063
00064 protected:
00065 virtual const lcore::ClassIdent *i_GetIdent() const { return &identifier; }
00066
00067 virtual void use_visitStrChunk(const StrChunkPtr &chunk,
00068 const LinearExtent &used)
00069 throw(halt_visitation);
00070
00071 virtual void use_visitDataBlock(const void *start, size_t len,
00072 const void *realstart, size_t reallen)
00073 throw(halt_visitation);
00074
00075 void printData(const void *data, size_t len);
00076
00077 private:
00078 typedef std::pair<const void *, const void *> edge_t;
00079 typedef std::set<edge_t> edgeset_t;
00080 std::ostream *out_;
00081 BufferChunk *data_;
00082 size_t rootpos_;
00083 edgeset_t edges_;
00084 };
00085
00086 };
00087 };
00088
00089 #endif