Jlm
Classes | Public Member Functions | Protected Member Functions | Private Attributes | List of all members
jlm::util::graph::Node Class Reference

#include <GraphWriter.hpp>

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

Classes

struct  Shape
 

Public Member Functions

 ~Node () override=default
 
const char * GetIdPrefix () const override
 
NodeGetNode () override
 
GraphGetGraph () override
 
virtual void SetShape (std::string shape)
 
void SetFillColor (std::string color) override
 
void OutputDotPortId (std::ostream &out) const override
 
void Output (std::ostream &out, OutputFormat format, size_t indent) const
 
virtual void OutputSubgraphs (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)
 
virtual void Finalize ()
 
bool IsFinalized () const
 
void OutputAttributes (std::ostream &out, AttributeOutputFormat format) const
 

Protected Member Functions

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

Private Attributes

friend Graph
 
GraphGraph_
 

Detailed Description

Abstract base class for all nodes in the GraphWriter. A Node is also a port, since edges can be attached to nodes directly.

Definition at line 361 of file GraphWriter.hpp.

Constructor & Destructor Documentation

◆ Node()

jlm::util::graph::Node::Node ( Graph graph)
explicitprotected

Definition at line 492 of file GraphWriter.cpp.

◆ ~Node()

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

Member Function Documentation

◆ GetGraph()

Graph & jlm::util::graph::Node::GetGraph ( )
overridevirtual
Returns
the graph this node belongs to

Reimplemented from jlm::util::graph::Port.

Definition at line 510 of file GraphWriter.cpp.

◆ GetIdPrefix()

const char * jlm::util::graph::Node::GetIdPrefix ( ) const
overridevirtual

Gets a short string that will serve as the base for a unique ID. This base should be a valid C-like identifier.

Returns
a string, such as "node", "i", "o", "graph"

Implements jlm::util::graph::GraphElement.

Reimplemented in jlm::util::graph::ResultNode, and jlm::util::graph::ArgumentNode.

Definition at line 498 of file GraphWriter.cpp.

◆ GetNode()

Node & jlm::util::graph::Node::GetNode ( )
overridevirtual

Implements jlm::util::graph::Port.

Definition at line 504 of file GraphWriter.cpp.

◆ Output()

void jlm::util::graph::Node::Output ( std::ostream &  out,
OutputFormat  format,
size_t  indent 
) const

Output the node to the ostream out, in the specified format. Lines printed while outputting are indented by at least indent levels. Depending on output format, this function may also recurse and print sub graphs.

Definition at line 535 of file GraphWriter.cpp.

◆ OutputASCII()

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

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 in jlm::util::graph::ResultNode, jlm::util::graph::ArgumentNode, and jlm::util::graph::InOutNode.

Definition at line 551 of file GraphWriter.cpp.

◆ OutputDot()

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

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

Reimplemented in jlm::util::graph::InOutNode.

Definition at line 568 of file GraphWriter.cpp.

◆ OutputDotPortId()

void jlm::util::graph::Node::OutputDotPortId ( std::ostream &  out) const
overridevirtual

Outputs the fully qualified port name, such as node8:i6:n Only used by the Dot printer.

Implements jlm::util::graph::Port.

Definition at line 529 of file GraphWriter.cpp.

◆ OutputSubgraphs()

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

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 in jlm::util::graph::InOutNode.

Definition at line 586 of file GraphWriter.cpp.

◆ SetFillColor()

void jlm::util::graph::Node::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.

Implements jlm::util::graph::Port.

Reimplemented in jlm::util::graph::InOutNode.

Definition at line 522 of file GraphWriter.cpp.

◆ SetShape()

void jlm::util::graph::Node::SetShape ( std::string  shape)
virtual

Sets the shape to be used when rendering the node

See also
Node::Shape

Reimplemented in jlm::util::graph::InOutNode.

Definition at line 516 of file GraphWriter.cpp.

Member Data Documentation

◆ Graph

friend jlm::util::graph::Node::Graph
private

Definition at line 363 of file GraphWriter.hpp.

◆ Graph_

Graph& jlm::util::graph::Node::Graph_
private

Definition at line 445 of file GraphWriter.hpp.


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