Jlm
Public Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
jlm::util::graph::Writer Class Reference

#include <GraphWriter.hpp>

Public Member Functions

 ~Writer ()=default
 
 Writer ()=default
 
 Writer (const Writer &other)=delete
 
 Writer (Writer &&other)=delete
 
Writeroperator= (const Writer &other)=delete
 
Writeroperator= (Writer &&other)=delete
 
GraphCreateGraph ()
 
size_t NumGraphs () const noexcept
 
GraphGetGraph (size_t index)
 
GraphElementGetElementFromProgramObject (uintptr_t object) const
 
template<typename T >
GraphElementGetElementFromProgramObject (const T &object) const
 
void Finalize ()
 
void outputAllGraphs (std::ostream &out, OutputFormat format)
 

Private Member Functions

GraphCreateSubGraph (Node &parentNode)
 
size_t GetNextUniqueIdStubSuffix (const char *idStub)
 

Private Attributes

std::vector< std::unique_ptr< Graph > > Graphs_
 
std::unordered_map< std::string, size_t > NextUniqueIdStubSuffix_
 

Friends

GraphInOutNode::CreateSubgraph ()
 
void GraphElement::Finalize ()
 

Detailed Description

Utility class for creating graphs in memory, and printing them to a human or machine readable format.

Definition at line 1024 of file GraphWriter.hpp.

Constructor & Destructor Documentation

◆ ~Writer()

jlm::util::graph::Writer::~Writer ( )
default

◆ Writer() [1/3]

jlm::util::graph::Writer::Writer ( )
default

◆ Writer() [2/3]

jlm::util::graph::Writer::Writer ( const Writer other)
delete

◆ Writer() [3/3]

jlm::util::graph::Writer::Writer ( Writer &&  other)
delete

Member Function Documentation

◆ CreateGraph()

Graph & jlm::util::graph::Writer::CreateGraph ( )

Creates a new graph and appends it to the GraphWriter's list of graphs.

Returns
a reference to the newly created graph

Definition at line 1426 of file GraphWriter.cpp.

◆ CreateSubGraph()

Graph & jlm::util::graph::Writer::CreateSubGraph ( Node parentNode)
private

Definition at line 1447 of file GraphWriter.cpp.

◆ Finalize()

void jlm::util::graph::Writer::Finalize ( )

Ensures that all graphs added to the graph writer so far are finalized. Recursively finalizes the GraphElements of each graph.

Definition at line 1472 of file GraphWriter.cpp.

◆ GetElementFromProgramObject() [1/2]

template<typename T >
GraphElement* jlm::util::graph::Writer::GetElementFromProgramObject ( const T &  object) const
inline

Definition at line 1069 of file GraphWriter.hpp.

◆ GetElementFromProgramObject() [2/2]

GraphElement * jlm::util::graph::Writer::GetElementFromProgramObject ( uintptr_t  object) const

Attempts to find a GraphElement in one of the graphs that is associated with object

Returns
the graph element associated with object, or nullptr if none is found

Definition at line 1455 of file GraphWriter.cpp.

◆ GetGraph()

Graph & jlm::util::graph::Writer::GetGraph ( size_t  index)
Returns
a reference to the graph with the given index, which must be lower than NumGraphs()

Definition at line 1440 of file GraphWriter.cpp.

◆ GetNextUniqueIdStubSuffix()

size_t jlm::util::graph::Writer::GetNextUniqueIdStubSuffix ( const char *  idStub)
private

Returns a unique suffix for the given idStub, starting at 0 and counting up

Returns
the next unique integer suffix for the given idStub

Definition at line 1465 of file GraphWriter.cpp.

◆ NumGraphs()

size_t jlm::util::graph::Writer::NumGraphs ( ) const
noexcept
Returns
the number of graphs in the GraphWriter

Definition at line 1434 of file GraphWriter.cpp.

◆ operator=() [1/2]

Writer& jlm::util::graph::Writer::operator= ( const Writer other)
delete

◆ operator=() [2/2]

Writer& jlm::util::graph::Writer::operator= ( Writer &&  other)
delete

◆ outputAllGraphs()

void jlm::util::graph::Writer::outputAllGraphs ( std::ostream &  out,
OutputFormat  format 
)

Finalizes and prints all graphs created in this GraphWriter.

Parameters
outthe output stream to write graphs to
formatthe format to emit the graphs in

Definition at line 1480 of file GraphWriter.cpp.

Friends And Related Function Documentation

◆ GraphElement::Finalize

void GraphElement::Finalize ( )
friend

◆ InOutNode::CreateSubgraph

Member Data Documentation

◆ Graphs_

std::vector<std::unique_ptr<Graph> > jlm::util::graph::Writer::Graphs_
private

Definition at line 1112 of file GraphWriter.hpp.

◆ NextUniqueIdStubSuffix_

std::unordered_map<std::string, size_t> jlm::util::graph::Writer::NextUniqueIdStubSuffix_
private

Definition at line 1115 of file GraphWriter.hpp.


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