The graph data builder is used to efficiently generate the graph data structure without the hassle of keeping intermediary values. More...
#include <GraphData.h>
Public Member Functions | |
Builder () | |
Builder. | |
void | setDependencies (const NodeName &name, const NodeNames &dependencies) |
set the dependencies of a node | |
void | setDependencies (const NodeName &name, const Dependencies &dependencies) |
set the dependencies of a node | |
void | setId (const NodeName &name, const NodeID &id) |
set the properties of a node | |
void | addDependency (const NodeID &from, const NodeID &to) |
void | setProperties (const NodeName &name, const NodeProperties &props) |
void | addProperty (const NodeName &name, const QString &pname, const QJsonValue &val) |
add a property to a specific node, overriding current property | |
void | setNodeInputNames (const NodeName &name, const Names &names) |
set inputs names for a particular node | |
void | setNodeOutputNames (const NodeName &name, const Names &names) |
set ouputs names for a particular node | |
void | setNode (const NodeName &name, const Node &node) |
set all node attribute given the node of a previous graph | |
QJsonObject & | properties (const NodeName &name) |
get json properties of a given node | |
void | setType (const NodeName &name, const NodeType &type) |
set the type of a node | |
void | setIoIndex (const NodeName &name, const Index &index) |
set input/output index of the node | |
const SharedData | build (const QString &filename) |
create a shared instance of SharedDta from the incremental builder | |
NodeID | id (const NodeName &name) |
get the id of a specific node | |
NodeType | type (const NodeID &id) |
type | |
NodeProperties | props (const NodeID &id) |
get node properties given the node id | |
Index | index (const NodeID &id) |
Dependencies | dependencies (const NodeID &id) |
Names | nodeInputNames (const NodeID &id) |
Names | nodeOutputNames (const NodeID &id) |
int | nodeInputCount (const NodeID &id) |
int | nodeOutputCount (const NodeID &id) |
const NodeIDs & | outputs () const |
const NodeIDs & | inputs () const |
NodeName | name (const NodeID &id) const |
The graph data builder is used to efficiently generate the graph data structure without the hassle of keeping intermediary values.
The main advantage of using this class to construct Graph data is the possibility to use string to refer to the nodes and edit their properties.
Graph::Builder b; b.setType("in",INPUT); b.setType("out",OUTPUT); b.setDependencies("out",{"in"}); SharedData data = b.build();
Definition at line 32 of file GraphData.h.
void Elve::GraphData::Builder::addProperty | ( | const NodeName & | name, |
const QString & | pname, | ||
const QJsonValue & | val | ||
) |
add a property to a specific node, overriding current property
name | name of the node |
pname | name of the property |
val | property value |
Definition at line 96 of file GraphData.cpp.
const SharedData Elve::GraphData::Builder::build | ( | const QString & | filename | ) |
create a shared instance of SharedDta from the incremental builder
filename | original filename of the graph, leave just a name if no filename |
THe newly created SharedData is then ready to be fed in the Graph primary constructor. using std::make_shared() for example.
Definition at line 134 of file GraphData.cpp.
NodeID Elve::GraphData::Builder::id | ( | const NodeName & | name | ) |
get the id of a specific node
name | name of the node |
Definition at line 33 of file GraphData.cpp.
QJsonObject & Elve::GraphData::Builder::properties | ( | const NodeName & | name | ) |
get json properties of a given node
name | name of the node |
Definition at line 111 of file GraphData.cpp.
NodeProperties Elve::GraphData::Builder::props | ( | const NodeID & | id | ) |
get node properties given the node id
id | id of the node |
Definition at line 53 of file GraphData.cpp.
void Elve::GraphData::Builder::setDependencies | ( | const NodeName & | name, |
const NodeNames & | dependencies | ||
) |
set the dependencies of a node
name | name of the node |
dependencies | direct dependencies of the node as an array of string |
Definition at line 82 of file GraphData.cpp.
void Elve::GraphData::Builder::setDependencies | ( | const NodeName & | name, |
const Dependencies & | dependencies | ||
) |
set the dependencies of a node
name | name of the node |
dependencies | array of Dependency to have differentiated inputs |
Definition at line 77 of file GraphData.cpp.
void Elve::GraphData::Builder::setId | ( | const NodeName & | name, |
const NodeID & | id | ||
) |
set the properties of a node
name | name of the node |
props |
Definition at line 168 of file GraphData.cpp.
void Elve::GraphData::Builder::setIoIndex | ( | const NodeName & | name, |
const Index & | index | ||
) |
set input/output index of the node
name | name of the node |
index | This index is used by most of the layouting plugins to know how the inputs are ordered |
Definition at line 130 of file GraphData.cpp.
void Elve::GraphData::Builder::setNode | ( | const NodeName & | name, |
const Node & | node | ||
) |
set all node attribute given the node of a previous graph
name | new name of the node |
node | previous node |
Definition at line 100 of file GraphData.cpp.
void Elve::GraphData::Builder::setNodeInputNames | ( | const NodeName & | name, |
const Names & | names | ||
) |
set inputs names for a particular node
name | name of the node |
names | names of the inputs in order |
Definition at line 158 of file GraphData.cpp.
void Elve::GraphData::Builder::setNodeOutputNames | ( | const NodeName & | name, |
const Names & | names | ||
) |
set ouputs names for a particular node
name | name of the node |
names | names of the outputs in order |
Definition at line 163 of file GraphData.cpp.
void Elve::GraphData::Builder::setType | ( | const NodeName & | name, |
const NodeType & | type | ||
) |
set the type of a node
name | name of the node |
type | node type (cf NodeType) |
Definition at line 120 of file GraphData.cpp.
NodeType Elve::GraphData::Builder::type | ( | const NodeID & | id | ) |