ELVE  1
ELVE Logic Visualization Explorer
Elve::GraphData::Builder Class Reference

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

Detailed Description

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.


Member Function Documentation

void Elve::GraphData::Builder::addProperty ( const NodeName &  name,
const QString &  pname,
const QJsonValue &  val 
)

add a property to a specific node, overriding current property

Parameters:
namename of the node
pnamename of the property
valproperty 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

Parameters:
filenameoriginal filename of the graph, leave just a name if no filename
Returns:
a SharedData instance

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

Parameters:
namename of the node
Returns:
the unique id associated to 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

Parameters:
namename of the node
Returns:
reference to properties

Definition at line 111 of file GraphData.cpp.

NodeProperties Elve::GraphData::Builder::props ( const NodeID &  id)

get node properties given the node id

Parameters:
idid of the node
Returns:

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

Parameters:
namename of the node
dependenciesdirect 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

Parameters:
namename of the node
dependenciesarray 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

Parameters:
namename 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

Parameters:
namename of the node
indexThis 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

Parameters:
namenew name of the node
nodeprevious 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

Parameters:
namename of the node
namesnames 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

Parameters:
namename of the node
namesnames 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

Parameters:
namename of the node
typenode type (cf NodeType)

Definition at line 120 of file GraphData.cpp.

NodeType Elve::GraphData::Builder::type ( const NodeID &  id)

type

Parameters:
id
Returns:
the type of the node

Definition at line 45 of file GraphData.cpp.

List of all members.


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