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

#include <GraphWriter.hpp>

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

Public Member Functions

 ~Port () override=default
 
virtual NodeGetNode ()=0
 
GraphGetGraph () override
 
virtual bool CanBeEdgeHead () const
 
virtual bool CanBeEdgeTail () const
 
const std::vector< Edge * > & GetConnections () const
 
bool HasOutgoingEdges () const
 
bool HasIncomingEdges () const
 
virtual void SetFillColor (std::string color)=0
 
virtual void OutputDotPortId (std::ostream &out) const =0
 
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
 
virtual const char * GetIdPrefix () const =0
 
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

 Port ()
 

Private Member Functions

void OnEdgeAdded (Edge &edge)
 

Private Attributes

friend Edge
 
std::vector< Edge * > Connections_
 

Detailed Description

Abstract class representing a part of a node that edges can be attached to

Definition at line 276 of file GraphWriter.hpp.

Constructor & Destructor Documentation

◆ Port()

jlm::util::graph::Port::Port ( )
protected

Definition at line 403 of file GraphWriter.cpp.

◆ ~Port()

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

Member Function Documentation

◆ CanBeEdgeHead()

bool jlm::util::graph::Port::CanBeEdgeHead ( ) const
virtual
Returns
true if a directed edge may have its head at this port, false otherwise

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

Definition at line 414 of file GraphWriter.cpp.

◆ CanBeEdgeTail()

bool jlm::util::graph::Port::CanBeEdgeTail ( ) const
virtual
Returns
true if a directed edge may have its tail at this port, false otherwise

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

Definition at line 420 of file GraphWriter.cpp.

◆ GetConnections()

const std::vector< Edge * > & jlm::util::graph::Port::GetConnections ( ) const
Returns
a list of all edges where one end is attached to this port.

Definition at line 426 of file GraphWriter.cpp.

◆ GetGraph()

Graph & jlm::util::graph::Port::GetGraph ( )
overridevirtual

Gets a reference to the graph this GraphElement belongs to

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

Reimplemented in jlm::util::graph::Node.

Definition at line 408 of file GraphWriter.cpp.

◆ GetNode()

virtual Node& jlm::util::graph::Port::GetNode ( )
pure virtual

◆ HasIncomingEdges()

bool jlm::util::graph::Port::HasIncomingEdges ( ) const
Returns
true if any edges are pointing at this port, or any non-directed edges are present

Definition at line 456 of file GraphWriter.cpp.

◆ HasOutgoingEdges()

bool jlm::util::graph::Port::HasOutgoingEdges ( ) const
Returns
true if any edges are leaving this port, or any non-directed edges are present

Definition at line 445 of file GraphWriter.cpp.

◆ OnEdgeAdded()

void jlm::util::graph::Port::OnEdgeAdded ( Edge edge)
private

Called when an edge has been added to the graph, to inform the edge's ports

Parameters
edgethe newly added edge

Definition at line 432 of file GraphWriter.cpp.

◆ OutputDotPortId()

virtual void jlm::util::graph::Port::OutputDotPortId ( std::ostream &  out) const
pure virtual

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

Implemented in jlm::util::graph::OutputPort, jlm::util::graph::InputPort, and jlm::util::graph::Node.

◆ OutputIncomingEdgesASCII()

void jlm::util::graph::Port::OutputIncomingEdgesASCII ( std::ostream &  out) const

Outputs the origin(s) of edges pointing to this port. Brackets are omitted when exactly one edge points to the port. Only used by the ASCII printer. Example outputs: "o4", "[]" and "[o2, o6]"

Definition at line 467 of file GraphWriter.cpp.

◆ SetFillColor()

virtual void jlm::util::graph::Port::SetFillColor ( std::string  color)
pure virtual

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.

Implemented in jlm::util::graph::InOutNode, jlm::util::graph::OutputPort, jlm::util::graph::InputPort, and jlm::util::graph::Node.

Member Data Documentation

◆ Connections_

std::vector<Edge *> jlm::util::graph::Port::Connections_
private

Definition at line 354 of file GraphWriter.hpp.

◆ Edge

friend jlm::util::graph::Port::Edge
private

Definition at line 278 of file GraphWriter.hpp.


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