mutable
A Database System for Research and Fast Prototyping
Loading...
Searching...
No Matches
Public Member Functions | Data Fields | Static Public Attributes | Private Attributes | Friends
m::DotTool Struct Reference

This class enables direct rendering of dot output (e.g. More...

#include <DotTool.hpp>

Collaboration diagram for m::DotTool:
[legend]

Public Member Functions

 DotTool (m::Diagnostic &diag)
 
std::ostream & stream ()
 
std::string str () const
 
int render_to_pdf (const char *path_to_pdf, const char *algo=DEFAULT_LAYOUT_ALGORITHM)
 Render the graph to the PDF file path_to_pdf using the given layouting algorithm.
 
void show (const char *name, bool interactive, const char *algo=DEFAULT_LAYOUT_ALGORITHM)
 Present the graph to the user.
 

Data Fields

m::Diagnosticdiag
 

Static Public Attributes

static constexpr const char * DEFAULT_LAYOUT_ALGORITHM = "dot"
 

Private Attributes

std::stringstream stream_
 

Friends

template<typename T >
DotTooloperator<< (DotTool &dot, T &&t)
 
std::ostream & operator<< (std::ostream &out, const DotTool &dot)
 

Detailed Description

This class enables direct rendering of dot output (e.g.

that of ASTDot). It uses the graphviz library to render the dot output directly to PDF.

Definition at line 13 of file DotTool.hpp.

Constructor & Destructor Documentation

◆ DotTool()

DotTool::DotTool ( m::Diagnostic diag)

Definition at line 54 of file DotTool.cpp.

References gvc, gvContext, libgraphviz, LOADSYM, and SYMBOLS.

Member Function Documentation

◆ render_to_pdf()

int DotTool::render_to_pdf ( const char *  path_to_pdf,
const char *  algo = DEFAULT_LAYOUT_ALGORITHM 
)

Render the graph to the PDF file path_to_pdf using the given layouting algorithm.

Returns
0 (zero) if rendering to PDF succeeded, non-zero otherwise

Definition at line 72 of file DotTool.cpp.

References agclose, agmemread, gvc, gvFreeLayout, gvLayout, gvRenderFilename, M_notnull, and stream_.

Referenced by show().

◆ show()

void DotTool::show ( const char *  name,
bool  interactive,
const char *  algo = DEFAULT_LAYOUT_ALGORITHM 
)

Present the graph to the user.

Automatically figures out the best way to do so.

Parameters
namethe name of the graph, used in the filename
interactivewhether the program runs interactively
algothe layouting algorithm to use

Definition at line 84 of file DotTool.cpp.

References diag, m::Diagnostic::err(), m::exec(), libgraphviz, m::Diagnostic::NOTE, m::Diagnostic::out(), render_to_pdf(), m::Diagnostic::RESET, and stream_.

Referenced by m::QueryDatabase::execute(), and m::execute_statement().

◆ str()

std::string m::DotTool::str ( ) const
inline

Definition at line 29 of file DotTool.hpp.

◆ stream()

std::ostream & m::DotTool::stream ( )
inline

Definition at line 27 of file DotTool.hpp.

Referenced by m::QueryDatabase::execute(), and m::execute_statement().

Friends And Related Function Documentation

◆ operator<< [1/2]

template<typename T >
DotTool & operator<< ( DotTool dot,
T &&  t 
)
friend

Definition at line 25 of file DotTool.hpp.

◆ operator<< [2/2]

std::ostream & operator<< ( std::ostream &  out,
const DotTool dot 
)
friend

Definition at line 31 of file DotTool.hpp.

Field Documentation

◆ DEFAULT_LAYOUT_ALGORITHM

constexpr const char* m::DotTool::DEFAULT_LAYOUT_ALGORITHM = "dot"
staticconstexpr

Definition at line 15 of file DotTool.hpp.

◆ diag

m::Diagnostic& m::DotTool::diag

Definition at line 17 of file DotTool.hpp.

Referenced by show().

◆ stream_

std::stringstream m::DotTool::stream_
private

Definition at line 19 of file DotTool.hpp.

Referenced by render_to_pdf(), and show().


The documentation for this struct was generated from the following files: