#include <GraphWriter.hpp>
Definition at line 39 of file GraphWriter.hpp.
◆ AttributeValue
◆ ~GraphElement()
| virtual jlm::util::graph::GraphElement::~GraphElement |
( |
| ) |
|
|
virtualdefault |
◆ GraphElement() [1/3]
| jlm::util::graph::GraphElement::GraphElement |
( |
| ) |
|
Constructs a graph element with no label, attributes or associated program object
Definition at line 149 of file GraphWriter.cpp.
◆ GraphElement() [2/3]
| jlm::util::graph::GraphElement::GraphElement |
( |
const GraphElement & |
other | ) |
|
|
delete |
◆ GraphElement() [3/3]
| jlm::util::graph::GraphElement::GraphElement |
( |
GraphElement && |
other | ) |
|
|
delete |
◆ AppendToLabel()
| void jlm::util::graph::GraphElement::AppendToLabel |
( |
std::string_view |
text, |
|
|
std::string_view |
sep = "\n" |
|
) |
| |
Appends the given text to the element's label. If the current label is non-empty, the separator string sep is inserted between them.
Definition at line 178 of file GraphWriter.cpp.
◆ Finalize()
| void jlm::util::graph::GraphElement::Finalize |
( |
| ) |
|
|
virtual |
◆ GetAttributeGraphElement()
| const GraphElement * jlm::util::graph::GraphElement::GetAttributeGraphElement |
( |
const std::string & |
attribute | ) |
const |
Retrieves the value of the given attribute, if it is assigned a graph element. Otherwise, if the attribute is assigned a program object, and there exists a GraphElement representing that program object, that is returned.
- Returns
- pointer to the GraphElement held in the attribute, or nullptr if it does not exist.
Definition at line 299 of file GraphWriter.cpp.
◆ GetAttributeObject()
| std::optional< uintptr_t > jlm::util::graph::GraphElement::GetAttributeObject |
( |
const std::string & |
attribute | ) |
const |
Retrieves the value of the given attribute, if it is assigned a program object. If the attribute does not exist, or is not holding a program object, std::nullopt is returned.
- Returns
- the object assigned to the attribute, or std::nullopt if it does not exist.
Definition at line 286 of file GraphWriter.cpp.
◆ GetAttributeString()
| std::optional< std::string_view > jlm::util::graph::GraphElement::GetAttributeString |
( |
const std::string & |
attribute | ) |
const |
Retrieves the value of the given attribute, if it exists and is assigned a string.
- Returns
- the attribute's string value, or std::nullopt if it does not exist.
Definition at line 273 of file GraphWriter.cpp.
◆ GetFullId()
| std::string jlm::util::graph::GraphElement::GetFullId |
( |
| ) |
const |
◆ GetGraph() [1/2]
| const Graph & jlm::util::graph::GraphElement::GetGraph |
( |
| ) |
const |
◆ GetGraph() [2/2]
| virtual Graph& jlm::util::graph::GraphElement::GetGraph |
( |
| ) |
|
|
pure virtual |
◆ GetIdPrefix()
| virtual const char* jlm::util::graph::GraphElement::GetIdPrefix |
( |
| ) |
const |
|
pure virtual |
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"
Implemented in jlm::util::graph::Graph, jlm::util::graph::Edge, jlm::util::graph::ResultNode, jlm::util::graph::ArgumentNode, jlm::util::graph::OutputPort, jlm::util::graph::InputPort, and jlm::util::graph::Node.
◆ GetLabel()
| const std::string & jlm::util::graph::GraphElement::GetLabel |
( |
| ) |
const |
◆ GetLabelOr()
| std::string_view jlm::util::graph::GraphElement::GetLabelOr |
( |
std::string_view |
otherwise | ) |
const |
- Returns
- the graph element's label, or if it is empty, the string
otherwise
Definition at line 203 of file GraphWriter.cpp.
◆ GetProgramObject()
| uintptr_t jlm::util::graph::GraphElement::GetProgramObject |
( |
| ) |
const |
|
noexcept |
- Returns
- the program object associated with this graph element.
Definition at line 241 of file GraphWriter.cpp.
◆ GetUniqueIdSuffix()
| size_t jlm::util::graph::GraphElement::GetUniqueIdSuffix |
( |
| ) |
const |
- Returns
- the unique suffix assigned to this element when finalized.
- See also
- IsFinalized() must return true before calling
Definition at line 211 of file GraphWriter.cpp.
◆ HasAttribute()
| bool jlm::util::graph::GraphElement::HasAttribute |
( |
const std::string & |
attribute | ) |
const |
- Returns
- true if an attribute with the given name
attribute is defined
Definition at line 267 of file GraphWriter.cpp.
◆ HasLabel()
| bool jlm::util::graph::GraphElement::HasLabel |
( |
| ) |
const |
- Returns
- true if this graph element has a non-empty label
Definition at line 191 of file GraphWriter.cpp.
◆ HasProgramObject()
| bool jlm::util::graph::GraphElement::HasProgramObject |
( |
| ) |
const |
|
noexcept |
◆ IsFinalized()
| bool jlm::util::graph::GraphElement::IsFinalized |
( |
| ) |
const |
◆ operator=() [1/2]
◆ operator=() [2/2]
◆ OutputAttributes()
| void jlm::util::graph::GraphElement::OutputAttributes |
( |
std::ostream & |
out, |
|
|
AttributeOutputFormat |
format |
|
) |
| const |
Prints the attributes of the graph element.
- Parameters
-
| out | the stream output is written to. |
| format | the output format to use. |
Definition at line 348 of file GraphWriter.cpp.
◆ RemoveAttribute()
| bool jlm::util::graph::GraphElement::RemoveAttribute |
( |
const std::string & |
attribute | ) |
|
Removes the attribute with the given name attribute, if it exists.
- Returns
- true if the attribute existed, and was removed, false otherwise
Definition at line 326 of file GraphWriter.cpp.
◆ RemoveProgramObject()
| void jlm::util::graph::GraphElement::RemoveProgramObject |
( |
| ) |
|
◆ SetAttribute()
| void jlm::util::graph::GraphElement::SetAttribute |
( |
const std::string & |
attribute, |
|
|
std::string |
value |
|
) |
| |
Assigns or overrides a given attribute on the element.
- Parameters
-
| attribute | the name of the attribute |
| value | the attribute value |
Definition at line 247 of file GraphWriter.cpp.
◆ SetAttributeGraphElement()
| void jlm::util::graph::GraphElement::SetAttributeGraphElement |
( |
const std::string & |
attribute, |
|
|
const GraphElement & |
element |
|
) |
| |
Assigns or overrides a given attribute on the element with a reference to a graph element. This allows associations between graph elements to be included in the output, across graphs. The element must be a part of the same GraphWriter instance.
- Parameters
-
| attribute | the name of the attribute. |
| element | the graph element whose id should be used as attribute value. |
Definition at line 260 of file GraphWriter.cpp.
◆ SetAttributeObject() [1/2]
template<typename T >
| void jlm::util::graph::GraphElement::SetAttributeObject |
( |
const std::string & |
attribute, |
|
|
const T & |
object |
|
) |
| |
|
inline |
Helper for calling SetAttributeObject with a pointer to any type
Definition at line 182 of file GraphWriter.hpp.
◆ SetAttributeObject() [2/2]
| void jlm::util::graph::GraphElement::SetAttributeObject |
( |
const std::string & |
attribute, |
|
|
uintptr_t |
object |
|
) |
| |
Assigns or overrides a given attribute on the element with the address of a program object. If this program object is associated with a GraphElement in the same GraphWriter, the attribute value becomes the id of the other GraphElement, instead of the address.
- Parameters
-
| attribute | the name of the attribute. |
| object | the address of a program object, must be non-null. |
Definition at line 253 of file GraphWriter.cpp.
◆ SetLabel()
| void jlm::util::graph::GraphElement::SetLabel |
( |
std::string |
label | ) |
|
Sets the element's label. A label is text intended to be visible in all renderings of the graph. Use an empty string to signify no label.
- Parameters
-
| label | the new label string |
Definition at line 172 of file GraphWriter.cpp.
◆ SetProgramObject()
template<typename T >
| void jlm::util::graph::GraphElement::SetProgramObject |
( |
const T & |
object | ) |
|
|
inline |
Graph elements often represent objects from the program. By making this association explicit, GraphElements can be looked up by program object. When using program objects as attributes, the association is used to refer to the unique id of its associated graph element, instead of the object's address. Within a graph, only one graph element can be associated with any given program object.
- Template Parameters
-
| T | the type of the program object to associate with |
- Parameters
-
Definition at line 136 of file GraphWriter.hpp.
◆ SetProgramObjectUintptr()
| void jlm::util::graph::GraphElement::SetProgramObjectUintptr |
( |
uintptr_t |
object | ) |
|
|
private |
◆ AttributeMap_
| std::unordered_map<std::string, AttributeValue> jlm::util::graph::GraphElement::AttributeMap_ |
|
private |
◆ Label_
| std::string jlm::util::graph::GraphElement::Label_ |
|
private |
◆ ProgramObject_
| uintptr_t jlm::util::graph::GraphElement::ProgramObject_ |
|
private |
◆ UniqueIdSuffix_
| std::optional<size_t> jlm::util::graph::GraphElement::UniqueIdSuffix_ |
|
private |
The documentation for this class was generated from the following files: