#include <graphattribs.h>
A graph attribute provides extra information about an attribute of nodes and ports. Attributes are identified and accessed only by an InternedId which carries no extra information about the attribute. If a GraphModelInterface wants to provide additional information for an attribute, its GraphModelInterface::GetGraphAttribute returns a graph attribute to get that information (such as the attribute FLAGS).
Public Types | |
enum class | FLAGS { NONE , DIRECT , DERIVED , USER_STATE , TRANSIENT , IMMUTABLE , META , ROOT , WARNING , ERROR , TYPE_MASK , MESSAGE_MASK } |
Public Member Functions | |
MAXON_METHOD const InternedId & | GetId () const |
enum maxon::GraphAttributeInterface::FLAGS | MAXON_ENUM_FLAGS_CLASS (FLAGS) |
MAXON_METHOD Bool | IsComputedFrom (const InternedId &other) const |
MAXON_METHOD FLAGS | GetFlags () const |
MAXON_METHOD Result< FLAGS > | GetMessageFlags (const GraphNode &node) const |
MAXON_METHOD Result< Bool > | GetMessages (const GraphNode &node, const ValueReceiver< const GraphMessage & > &receiver) const |
Private Member Functions | |
MAXON_INTERFACE (GraphAttributeInterface, MAXON_REFERENCE_CONST, "net.maxon.graph.interface.attribute") | |
|
strong |
FLAGS provide information about the nature of the attribute. Exactly one of DIRECT, DERIVED, USER_STATE or DERIVED|USER_STATE has to be set in the flags returned by GetFlags().
Enumerator | |
---|---|
NONE | No flag set. |
DIRECT | The attribute is an attribute which can be set directly by program code. |
DERIVED | The attribute is a derived attribute which can't be set by program code. The graph model implementation will derive its value from the graph. |
USER_STATE | The attribute is a user-state attribute which can be set by program code and doesn't belong to the persistent state of the graph. User-state attributes can be set outside of a GraphTransaction, and there is the method GraphModelInterface::ResetUserState. A user-state attribute also has to set the TRANSIENT flag. The flag DERIVED can be set in addition for a derived user-state attribute. |
TRANSIENT | The attribute is transient (non-persistent, i.e., not stored by serialization). |
IMMUTABLE | The attribute value can only be set once on creation of the node or port. |
META | The attribute is a meta attribute whose value is irrelevant for the data model and runtime behaviour of the graph. What exactly this means is graph-model-specific. |
ROOT | The attribute is a graph-global attribute which is stored at the root. When the value of such an attribute is read, it is always read at the root node even if the GetValue method was called on another node. Inner graphs will use the root node of their outmost enclosing graph. |
WARNING | The attribute represents a warning message. Typically this is a user-state attribute set during the analysis of the graph to inform about questionable findings. |
ERROR | The attribute represents an error message. Typically this is a user-state attribute set during the analysis of the graph to inform about found errors. |
TYPE_MASK | Use this mask to test for the type (one of DIRECT, DERIVED, USER_STATE or DERIVED|USER_STATE). |
MESSAGE_MASK | Use this mask to test for WARNING or ERROR. |
|
private |
MAXON_METHOD const InternedId& GetId | ( | ) | const |
Returns the id of this attribute.
enum maxon::GraphAttributeInterface::FLAGS MAXON_ENUM_FLAGS_CLASS | ( | FLAGS | ) |
MAXON_METHOD Bool IsComputedFrom | ( | const InternedId & | other | ) | const |
Checks for a derived attribute if its value is computed on-the-fly and needs the value of other for that computation. A derived attribute may store its value in the graph, or it may compute it on-the-fly. In the latter case you can check the required attributes with this method. This is important e.g. when you check for attribute modifications using GraphNodeFunctions::GetAttributeModificationsSince: You only get notified about changes of stored attribute values, so for a computed value you have to use this method:
You can use this method even for non-computed attributes, then it returns true if other is the same as #this.
[in] | other | Another attribute. |
MAXON_METHOD FLAGS GetFlags | ( | ) | const |
Returns the flags of this attribute. If FLAGS::ERROR or FLAGS::WARNING is set, this means that the attribute can contain an error or warning, however a check for a concrete node using GetMessageFlags has to be done to test if the value of the attribute at that node really contains an error or warning.
Usually you shouldn't call this method directly, but use GraphModelInterface::GetGraphAttributeFlags.
MAXON_METHOD Result<FLAGS> GetMessageFlags | ( | const GraphNode & | node | ) | const |
Returns the message flags of the attribute value at node. An attribute which may contain an error or warning according to GetFlags() doesn't necessarily have to do so, you have to test for a concrete node if the value of the attribute at that node really contains an error or warning.
Usually you shouldn't call this method directly, but use GraphNode::GetMessageFlags.
[in] | node | A node or port where the message flags of this attribute shall be checked. |
MAXON_METHOD Result<Bool> GetMessages | ( | const GraphNode & | node, |
const ValueReceiver< const GraphMessage & > & | receiver | ||
) | const |
Yields the messages of this attribute at node to #receiver.
Usually you shouldn't call this method directly, but use GraphNode::GetMessages.
[in] | node | A node or port at which the messages shall be obtained. |
[in] | receiver | All messages are reported to this receiver. |