TuttleOFX  1
TuttleOFX/libraries/tuttle/src/tuttle/host/graph/GraphExporter.hpp
Go to the documentation of this file.
00001 #ifndef _TUTTLE_HOST_GRAPHEXPORTER_HPP_
00002 #define _TUTTLE_HOST_GRAPHEXPORTER_HPP_
00003 
00004 #include <iostream>
00005 
00006 namespace tuttle {
00007 namespace host {
00008 namespace graph {
00009 
00010 namespace detail {
00011 template<class T>
00012 struct DotEntry
00013 {
00014         DotEntry( const std::string& key, const T& value )
00015                 : _key( key )
00016                 , _value( value )
00017         {}
00018         const std::string& _key;
00019         const T& _value;
00020         template<class TT>
00021         friend std::ostream& operator<<( std::ostream& os, const DotEntry<TT>& d );
00022 };
00023 template<class T>
00024 struct SubDotEntry : public DotEntry<T>
00025 {
00026         SubDotEntry( const std::string& key, const T& value )
00027                 : DotEntry<T>( key, value )
00028         {}
00029         template<class TT>
00030         friend std::ostream& operator<<( std::ostream& os, const SubDotEntry<TT>& d );
00031 };
00032 }
00033 template<typename Vertex, typename ProcessEdge, typename OutEdgeList, typename VertexList, typename EdgeList>
00034 class InternalGraph;
00035 
00036 /**
00037  * @brief Use this function to force the correct syntax.
00038  *        os << dotEntry( "label", "fooNode");
00039  *        output: [label="fooNode"]
00040  */
00041 template<class T>
00042 detail::DotEntry<T> dotEntry( const std::string& key, const T& value );
00043 template<class T>
00044 detail::SubDotEntry<T> subDotEntry( const std::string& key, const T& value );
00045 
00046 template<typename Vertex, typename ProcessEdge, typename OutEdgeList, typename VertexList, typename EdgeList>
00047 inline void exportSimple( std::ostream& os, const InternalGraph<Vertex, ProcessEdge, OutEdgeList, VertexList, EdgeList>& g );
00048 
00049 template<typename Vertex, typename ProcessEdge, typename OutEdgeList, typename VertexList, typename EdgeList>
00050 inline void exportAsDOT( std::ostream& os, const InternalGraph<Vertex, ProcessEdge, OutEdgeList, VertexList, EdgeList>& g );
00051 
00052 template<typename Vertex, typename ProcessEdge, typename OutEdgeList, typename VertexList, typename EdgeList>
00053 inline void exportAsDOT( const std::string& filename, const InternalGraph<Vertex, ProcessEdge, OutEdgeList, VertexList, EdgeList>& g );
00054 
00055 
00056 template<typename Vertex, typename ProcessEdge, typename OutEdgeList, typename VertexList, typename EdgeList>
00057 inline void exportDebugAsDOT( std::ostream& os, const InternalGraph<Vertex, ProcessEdge, OutEdgeList, VertexList, EdgeList>& g );
00058 
00059 template<typename Vertex, typename ProcessEdge, typename OutEdgeList, typename VertexList, typename EdgeList>
00060 inline void exportDebugAsDOT( const std::string& filename, const InternalGraph<Vertex, ProcessEdge, OutEdgeList, VertexList, EdgeList>& g );
00061 
00062 }
00063 }
00064 }
00065 
00066 #include "GraphExporter.tcc"
00067 
00068 #endif
00069