Jlm
Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | List of all members
jlm::util::graph::InOutNode Class Referencefinal

#include <GraphWriter.hpp>

Inheritance diagram for jlm::util::graph::InOutNode:
Inheritance graph
[legend]
Collaboration diagram for jlm::util::graph::InOutNode:
Collaboration graph
[legend]

Public Member Functions

 ~InOutNode () override=default
 
void SetShape (std::string) override
 
InputPortCreateInputPort ()
 
size_t NumInputPorts () const
 
InputPortGetInputPort (size_t index)
 
OutputPortCreateOutputPort ()
 
size_t NumOutputPorts () const
 
OutputPortGetOutputPort (size_t index)
 
GraphCreateSubgraph ()
 
size_t NumSubgraphs () const
 
GraphGetSubgraph (size_t index)
 
void SetHtmlTableAttribute (std::string name, std::string value)
 
void SetFillColor (std::string color) override
 
void Finalize () override
 
void OutputSubgraphs (std::ostream &out, OutputFormat format, size_t indent) const override
 
- Public Member Functions inherited from jlm::util::graph::Node
 ~Node () override=default
 
const char * GetIdPrefix () const override
 
NodeGetNode () override
 
GraphGetGraph () override
 
void OutputDotPortId (std::ostream &out) const override
 
void Output (std::ostream &out, OutputFormat format, size_t indent) const
 
- Public Member Functions inherited from jlm::util::graph::Port
 ~Port () override=default
 
virtual bool CanBeEdgeHead () const
 
virtual bool CanBeEdgeTail () const
 
const std::vector< Edge * > & GetConnections () const
 
bool HasOutgoingEdges () const
 
bool HasIncomingEdges () const
 
void OutputIncomingEdgesASCII (std::ostream &out) const
 
- Public Member Functions inherited from jlm::util::graph::GraphElement
virtual ~GraphElement ()=default
 
 GraphElement ()
 
 GraphElement (const GraphElement &other)=delete
 
 GraphElement (GraphElement &&other)=delete
 
GraphElementoperator= (const GraphElement &other)=delete
 
GraphElementoperator= (GraphElement &&other)=delete
 
std::string GetFullId () const
 
const GraphGetGraph () const
 
void SetLabel (std::string label)
 
void AppendToLabel (std::string_view text, std::string_view sep="\n")
 
bool HasLabel () const
 
const std::string & GetLabel () const
 
std::string_view GetLabelOr (std::string_view otherwise) const
 
size_t GetUniqueIdSuffix () const
 
template<typename T >
void SetProgramObject (const T &object)
 
void RemoveProgramObject ()
 
bool HasProgramObject () const noexcept
 
uintptr_t GetProgramObject () const noexcept
 
void SetAttribute (const std::string &attribute, std::string value)
 
void SetAttributeObject (const std::string &attribute, uintptr_t object)
 
template<typename T >
void SetAttributeObject (const std::string &attribute, const T &object)
 
void SetAttributeGraphElement (const std::string &attribute, const GraphElement &element)
 
bool HasAttribute (const std::string &attribute) const
 
std::optional< std::string_view > GetAttributeString (const std::string &attribute) const
 
std::optional< uintptr_t > GetAttributeObject (const std::string &attribute) const
 
const GraphElementGetAttributeGraphElement (const std::string &attribute) const
 
bool RemoveAttribute (const std::string &attribute)
 
bool IsFinalized () const
 
void OutputAttributes (std::ostream &out, AttributeOutputFormat format) const
 

Protected Member Functions

void OutputASCII (std::ostream &out, size_t indent) const override
 
void OutputDot (std::ostream &out, size_t indent) const override
 
- Protected Member Functions inherited from jlm::util::graph::Node
 Node (Graph &graph)
 
- Protected Member Functions inherited from jlm::util::graph::Port
 Port ()
 

Private Member Functions

 InOutNode (Graph &graph, size_t inputPorts, size_t outputPorts)
 

Private Attributes

friend Graph
 
std::unordered_map< std::string, std::string > HtmlTableAttributes_
 
std::vector< std::unique_ptr< InputPort > > InputPorts_
 
std::vector< std::unique_ptr< OutputPort > > OutputPorts_
 
std::vector< Graph * > SubGraphs_
 

Detailed Description

Class representing a node where data flows into a set of input ports, and results flow out of a set of output ports. For complex operations, the node can also contain one or more sub-graphs.

Definition at line 519 of file GraphWriter.hpp.

Constructor & Destructor Documentation

◆ InOutNode()

jlm::util::graph::InOutNode::InOutNode ( Graph graph,
size_t  inputPorts,
size_t  outputPorts 
)
private

Definition at line 665 of file GraphWriter.cpp.

◆ ~InOutNode()

jlm::util::graph::InOutNode::~InOutNode ( )
overridedefault

Member Function Documentation

◆ CreateInputPort()

InputPort & jlm::util::graph::InOutNode::CreateInputPort ( )

Definition at line 684 of file GraphWriter.cpp.

◆ CreateOutputPort()

OutputPort & jlm::util::graph::InOutNode::CreateOutputPort ( )

Definition at line 705 of file GraphWriter.cpp.

◆ CreateSubgraph()

Graph & jlm::util::graph::InOutNode::CreateSubgraph ( )

Creates a new subgraph and

Returns
a reference to the newly created subgraph

Definition at line 726 of file GraphWriter.cpp.

◆ Finalize()

void jlm::util::graph::InOutNode::Finalize ( )
overridevirtual

Claims a unique id suffix for the element, if it doesn't already have one.

Reimplemented from jlm::util::graph::GraphElement.

Definition at line 759 of file GraphWriter.cpp.

◆ GetInputPort()

InputPort & jlm::util::graph::InOutNode::GetInputPort ( size_t  index)

Definition at line 698 of file GraphWriter.cpp.

◆ GetOutputPort()

OutputPort & jlm::util::graph::InOutNode::GetOutputPort ( size_t  index)

Definition at line 719 of file GraphWriter.cpp.

◆ GetSubgraph()

Graph & jlm::util::graph::InOutNode::GetSubgraph ( size_t  index)
Returns
the subgraph with the given index, which must be lower than NumSubgraphs()

Definition at line 740 of file GraphWriter.cpp.

◆ NumInputPorts()

size_t jlm::util::graph::InOutNode::NumInputPorts ( ) const

Definition at line 692 of file GraphWriter.cpp.

◆ NumOutputPorts()

size_t jlm::util::graph::InOutNode::NumOutputPorts ( ) const

Definition at line 713 of file GraphWriter.cpp.

◆ NumSubgraphs()

size_t jlm::util::graph::InOutNode::NumSubgraphs ( ) const
Returns
the number of subgraphs in this node

Definition at line 734 of file GraphWriter.cpp.

◆ OutputASCII()

void jlm::util::graph::InOutNode::OutputASCII ( std::ostream &  out,
size_t  indent 
) const
overrideprotectedvirtual

Outputs the node in ASCII format to the ostream out, indented by indent levels. In this format, attributes are ignored, and edges are only included implicitly, by listing the origins of all edges pointing into this node.

Reimplemented from jlm::util::graph::Node.

Definition at line 779 of file GraphWriter.cpp.

◆ OutputDot()

void jlm::util::graph::InOutNode::OutputDot ( std::ostream &  out,
size_t  indent 
) const
overrideprotectedvirtual

Outputs the node in Dot format to the ostream out, indented by indent levels. This format includes all attributes. Edges are output

Reimplemented from jlm::util::graph::Node.

Definition at line 820 of file GraphWriter.cpp.

◆ OutputSubgraphs()

void jlm::util::graph::InOutNode::OutputSubgraphs ( std::ostream &  out,
OutputFormat  format,
size_t  indent 
) const
overridevirtual

Prints all sub graphs of the node, to the given ostream out, in the given format.

  • All lines printed by this function are indented by at least indent levels. This function is recursive, as sub graphs may have nodes with sub graphs of their own.

Reimplemented from jlm::util::graph::Node.

Definition at line 772 of file GraphWriter.cpp.

◆ SetFillColor()

void jlm::util::graph::InOutNode::SetFillColor ( std::string  color)
overridevirtual

Helper function for setting the background color of the Port using the correct dot attributes.

Parameters
coloran X11 color name or an RGB value in hex, prefixed by '#'
See also
jlm::util::Colors namespace for a list of common colors.

Reimplemented from jlm::util::graph::Node.

Definition at line 753 of file GraphWriter.cpp.

◆ SetHtmlTableAttribute()

void jlm::util::graph::InOutNode::SetHtmlTableAttribute ( std::string  name,
std::string  value 
)

Set attributes on the HTML-like table used to render the node in dot. See the GraphViz manual's list of table attributes: https://graphviz.org/doc/info/shapes.html#table

Parameters
namethe name of the attribute
valuethe value the attribute should take
See also
SetAttribute for setting attributes on the node itself

Definition at line 747 of file GraphWriter.cpp.

◆ SetShape()

void jlm::util::graph::InOutNode::SetShape ( std::string  )
overridevirtual

InOutNodes use HTML tables when rendering, so setting the shape is disabled

Reimplemented from jlm::util::graph::Node.

Definition at line 678 of file GraphWriter.cpp.

Member Data Documentation

◆ Graph

friend jlm::util::graph::InOutNode::Graph
private

Definition at line 521 of file GraphWriter.hpp.

◆ HtmlTableAttributes_

std::unordered_map<std::string, std::string> jlm::util::graph::InOutNode::HtmlTableAttributes_
private

Definition at line 599 of file GraphWriter.hpp.

◆ InputPorts_

std::vector<std::unique_ptr<InputPort> > jlm::util::graph::InOutNode::InputPorts_
private

Definition at line 601 of file GraphWriter.hpp.

◆ OutputPorts_

std::vector<std::unique_ptr<OutputPort> > jlm::util::graph::InOutNode::OutputPorts_
private

Definition at line 602 of file GraphWriter.hpp.

◆ SubGraphs_

std::vector<Graph *> jlm::util::graph::InOutNode::SubGraphs_
private

Definition at line 603 of file GraphWriter.hpp.


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