#include <GraphWriter.hpp>
Definition at line 41 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 191 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 226 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 347 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 334 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 321 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 251 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 289 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 259 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 315 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 239 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]
◆ OutputAttribute()
| void jlm::util::graph::GraphElement::OutputAttribute |
( |
std::ostream & |
out, |
|
|
const std::string & |
name, |
|
|
AttributeOutputFormat |
format |
|
) |
| const |
|
private |
◆ 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 456 of file GraphWriter.cpp.
◆ outputJsonObjectOpening()
| void jlm::util::graph::GraphElement::outputJsonObjectOpening |
( |
std::ostream & |
out, |
|
|
size_t |
indent, |
|
|
bool & |
firstField |
|
) |
| const |
Outputs the id and common fields of the graph element. For example, for a graph element with id node0:
"node0": { "label": "Its Label", "object": "0x7fff5623", "attr": {"key": "value", "key2": "value2"}
The output ends without a comma or newline. Use the resulting firstField boolean when adding additional fields.
- Parameters
-
| out | the output stream to write to |
| indent | the level of indentation for the key |
| firstField | set to true if the object is still waiting for its first field |
Definition at line 533 of file GraphWriter.cpp.
◆ PrintFullId()
| void jlm::util::graph::GraphElement::PrintFullId |
( |
std::ostream & |
out | ) |
const |
◆ 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 374 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 295 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 308 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 193 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 301 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 220 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 147 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: