TuttleOFX  1
tuttle::host::Graph Class Reference

A user graph to manipulate OpenFX nodes. More...

#include <Graph.hpp>

Collaboration diagram for tuttle::host::Graph:

Public Types

enum  EDotExportLevel { eDotExportLevelSimple, eDotExportLevelDetailed }
typedef graph::UVertex Vertex
typedef graph::UEdge Edge
typedef INode Node
typedef attribute::Attribute Attribute
typedef graph::InternalGraph
< Vertex, Edge
InternalGraphImpl
typedef
InternalGraphImpl::vertex_descriptor 
vertex_descriptor
typedef
InternalGraphImpl::edge_descriptor 
edge_descriptor
typedef std::map< std::string,
int > 
InstanceCountMap
typedef boost::ptr_map
< std::string, Node
NodeMap

Public Member Functions

 Graph ()
 ~Graph ()
InputBufferWrapper createInputBuffer ()
 Create a new input node in the current graph, to give an input buffer.
OutputBufferWrapper createOutputBuffer ()
 Create a new output buffer node in the current graph, wrapped up for easy use.
NodecreateNode (const std::string &id)
 Create a new node in the graph.
NodeaddNode (const NodeInit &node)
 Add a node to the graph. It takes the ownership of the node object.
NodeaddNode (INode &node)
 Add a node to the graph. It takes the ownership of the node object.
std::vector< INode * > addNodes (const std::vector< NodeInit > &nodes)
 Add nodes to the graph.
std::vector< INode * > addConnectedNodes (const std::vector< NodeInit > &nodes)
 Add nodes to the graph and connect them linearly.
void renameNode (Node &node, const std::string &newUniqueName)
 Rename a node in the current graph.
void deleteNode (Node &node)
 Delete a node from the current graph. This will remove all the connections.
void connect (const std::string &outNode, const std::string &inNode, const std::string &inAttr=kOfxSimpleSourceAttributeName)
 Connect nodes (using there unique name in this graph).
void connect (const std::list< std::string > &nodes)
 Connect nodes the list of nodes linearly.
void connect (const Node &outNode, const Node &inNode)
void connect (const std::list< Node * > &nodes)
void connect (const std::vector< Node * > &nodes)
void connect (const Node &outNode, const Attribute &inAttr)
void connect (const Attribute &outAttr, const Attribute &inAttr)
void unconnect (const Attribute &outAttr, const Attribute &inAttr)
void unconnect (const Node &node)
void replaceNodeConnections (const Node &fromNode, const Node &toNode)
std::size_t getNbInputConnections (const Node &node) const
std::size_t getNbOutputConnections (const Node &node) const
void init ()
 Temporary solution ! Prepare the user graph, so we can call getTimeDomain (and maybe others functions) on nodes.
void setup ()
void setupAtTime (const OfxTime time, const NodeListArg &nodes=NodeListArg())
void computeGlobalHashAtTime (NodeHashContainer &outNodesHash, const OfxTime time, const NodeListArg &nodes=NodeListArg())
bool compute (const ComputeOptions &options=ComputeOptions())
 Shortcut.
bool compute (const NodeListArg &nodes, const ComputeOptions &options=ComputeOptions())
 Shortcut.
bool compute (memory::MemoryCache &memoryCache, const ComputeOptions &options)
bool compute (memory::MemoryCache &memoryCache, const NodeListArg &nodes=NodeListArg(), const ComputeOptions &options=ComputeOptions())
const InternalGraphImplgetGraph () const
const NodeMapgetNodes () const
NodeMapgetNodes ()
std::vector< Node * > getNodesByContext (const std::string &type)
std::vector< Node * > getNodesByPlugin (const std::string &pluginId)
const NodegetNode (const std::string &name) const
NodegetNode (const std::string &name)
const InstanceCountMapgetInstanceCount () const
void exportDot (const std::string &filename, const EDotExportLevel level=eDotExportLevelSimple) const

Private Member Functions

void addToInternalGraph (Node &node)
void removeFromInternalGraph (Node &node)

Private Attributes

InternalGraphImpl _graph
NodeMap _nodes
InstanceCountMap _instanceCount
 used to assign a unique name to each node

Friends

std::ostream & operator<< (std::ostream &os, const Graph &g)

Detailed Description

A user graph to manipulate OpenFX nodes.

Definition at line 39 of file Graph.hpp.


Member Typedef Documentation

Todo:
tuttle INode...

Definition at line 45 of file Graph.hpp.

Definition at line 43 of file Graph.hpp.

typedef std::map<std::string, int> tuttle::host::Graph::InstanceCountMap

Definition at line 50 of file Graph.hpp.

Definition at line 44 of file Graph.hpp.

typedef boost::ptr_map<std::string, Node> tuttle::host::Graph::NodeMap

Definition at line 51 of file Graph.hpp.

Definition at line 42 of file Graph.hpp.


Member Enumeration Documentation

Enumerator:
eDotExportLevelSimple 
eDotExportLevelDetailed 

Definition at line 179 of file Graph.hpp.


Constructor & Destructor Documentation

tuttle::host::Graph::Graph ( )

Definition at line 19 of file Graph.cpp.

tuttle::host::Graph::~Graph ( )

Definition at line 22 of file Graph.cpp.


Member Function Documentation

std::vector< INode * > tuttle::host::Graph::addConnectedNodes ( const std::vector< NodeInit > &  nodes)

Add nodes to the graph and connect them linearly.

Warning:
: Nodes will be renamed.

Definition at line 76 of file Graph.cpp.

References addNodes(), and connect().

Referenced by BOOST_AUTO_TEST_CASE(), and tuttle::host::compute().

Here is the call graph for this function:

Graph::Node & tuttle::host::Graph::addNode ( const NodeInit node)

Add a node to the graph. It takes the ownership of the node object.

Warning:
: The node will be renamed.

Definition at line 47 of file Graph.cpp.

References tuttle::host::NodeInit::release().

Referenced by addNodes(), BOOST_AUTO_TEST_CASE(), and createNode().

Here is the call graph for this function:

Graph::Node & tuttle::host::Graph::addNode ( INode node)

Add a node to the graph. It takes the ownership of the node object.

Warning:
: The node will be renamed.

Definition at line 52 of file Graph.cpp.

References _instanceCount, _nodes, addToInternalGraph(), tuttle::host::INode::getLabel(), tuttle::host::INode::getName(), and tuttle::host::INode::setName().

Here is the call graph for this function:

std::vector< INode * > tuttle::host::Graph::addNodes ( const std::vector< NodeInit > &  nodes)

Add nodes to the graph.

Warning:
: Nodes will be renamed.

Definition at line 65 of file Graph.cpp.

References addNode().

Referenced by addConnectedNodes().

Here is the call graph for this function:

void tuttle::host::Graph::addToInternalGraph ( Node node) [private]

Definition at line 121 of file Graph.cpp.

References _graph, tuttle::host::graph::InternalGraph< VERTEX, EDGE, OutEdgeList, VertexList, EdgeList >::addVertex(), and tuttle::host::INode::getName().

Referenced by addNode(), and renameNode().

Here is the call graph for this function:

bool tuttle::host::Graph::compute ( const NodeListArg nodes,
const ComputeOptions options = ComputeOptions() 
)

Shortcut.

Definition at line 329 of file Graph.cpp.

References compute().

Here is the call graph for this function:

bool tuttle::host::Graph::compute ( memory::MemoryCache memoryCache,
const ComputeOptions options 
)

Definition at line 337 of file Graph.cpp.

References compute().

Here is the call graph for this function:

bool tuttle::host::Graph::compute ( memory::MemoryCache memoryCache,
const NodeListArg nodes = NodeListArg(),
const ComputeOptions options = ComputeOptions() 
)

Definition at line 342 of file Graph.cpp.

References _graph, tuttle::host::graph::exportAsDOT(), tuttle::host::NodeListArg::getNodes(), and tuttle::host::graph::ProcessGraph::process().

Here is the call graph for this function:

void tuttle::host::Graph::computeGlobalHashAtTime ( NodeHashContainer outNodesHash,
const OfxTime  time,
const NodeListArg nodes = NodeListArg() 
)

Definition at line 317 of file Graph.cpp.

References tuttle::host::graph::ProcessGraph::computeHashAtTime(), and tuttle::host::NodeListArg::getNodes().

Here is the call graph for this function:

void tuttle::host::Graph::connect ( const std::string &  outNode,
const std::string &  inNode,
const std::string &  inAttr = kOfxSimpleSourceAttributeName 
)

Connect nodes (using there unique name in this graph).

Definition at line 147 of file Graph.cpp.

References getNode().

Referenced by addConnectedNodes(), BOOST_AUTO_TEST_CASE(), connect(), sam::connectClips(), main(), and replaceNodeConnections().

Here is the call graph for this function:

void tuttle::host::Graph::connect ( const std::list< std::string > &  nodes)

Connect nodes the list of nodes linearly.

Definition at line 152 of file Graph.cpp.

References connect().

Here is the call graph for this function:

void tuttle::host::Graph::connect ( const Node outNode,
const Node inNode 
)

Definition at line 170 of file Graph.cpp.

References connect(), and tuttle::host::INode::getSingleInputAttribute().

Here is the call graph for this function:

void tuttle::host::Graph::connect ( const std::list< Node * > &  nodes)

Definition at line 175 of file Graph.cpp.

References connect().

Here is the call graph for this function:

void tuttle::host::Graph::connect ( const std::vector< Node * > &  nodes)

Definition at line 193 of file Graph.cpp.

References connect().

Here is the call graph for this function:

void tuttle::host::Graph::connect ( const Node outNode,
const Attribute inAttr 
)
void tuttle::host::Graph::connect ( const Attribute outAttr,
const Attribute inAttr 
)
InputBufferWrapper tuttle::host::Graph::createInputBuffer ( )

Create a new input node in the current graph, to give an input buffer.

Definition at line 25 of file Graph.cpp.

References createNode().

Here is the call graph for this function:

Graph::Node & tuttle::host::Graph::createNode ( const std::string &  id)

Create a new node in the graph.

Parameters:
idis the plugin unique string identification (e.g. "tuttle.blur").

Definition at line 41 of file Graph.cpp.

References addNode().

Referenced by BOOST_AUTO_TEST_CASE(), createInputBuffer(), createOutputBuffer(), and main().

Here is the call graph for this function:

OutputBufferWrapper tuttle::host::Graph::createOutputBuffer ( )

Create a new output buffer node in the current graph, wrapped up for easy use.

Definition at line 33 of file Graph.cpp.

References createNode().

Here is the call graph for this function:

void tuttle::host::Graph::deleteNode ( Node node)

Delete a node from the current graph. This will remove all the connections.

Definition at line 135 of file Graph.cpp.

References _nodes, tuttle::host::INode::getName(), and removeFromInternalGraph().

Here is the call graph for this function:

void tuttle::host::Graph::exportDot ( const std::string &  filename,
const EDotExportLevel  level = eDotExportLevelSimple 
) const

Definition at line 396 of file Graph.cpp.

References _graph, eDotExportLevelDetailed, eDotExportLevelSimple, and tuttle::host::graph::exportAsDOT().

Here is the call graph for this function:

const InternalGraphImpl& tuttle::host::Graph::getGraph ( ) const [inline]

Definition at line 168 of file Graph.hpp.

References _graph.

Referenced by tuttle::host::operator<<(), and tuttle::host::graph::ProcessGraph::updateGraph().

const InstanceCountMap& tuttle::host::Graph::getInstanceCount ( ) const [inline]

Definition at line 176 of file Graph.hpp.

References _instanceCount.

std::size_t tuttle::host::Graph::getNbInputConnections ( const Node node) const
std::size_t tuttle::host::Graph::getNbOutputConnections ( const Node node) const
const Node& tuttle::host::Graph::getNode ( const std::string &  name) const [inline]

Definition at line 174 of file Graph.hpp.

References _nodes.

Referenced by BOOST_AUTO_TEST_CASE(), connect(), and sam::connectClips().

Node& tuttle::host::Graph::getNode ( const std::string &  name) [inline]

Definition at line 175 of file Graph.hpp.

References getNodes().

Here is the call graph for this function:

const NodeMap& tuttle::host::Graph::getNodes ( ) const [inline]

Definition at line 169 of file Graph.hpp.

References _nodes.

Referenced by getNode(), getNodesByContext(), and getNodesByPlugin().

NodeMap& tuttle::host::Graph::getNodes ( ) [inline]

Definition at line 170 of file Graph.hpp.

References _nodes.

std::vector< Graph::Node * > tuttle::host::Graph::getNodesByContext ( const std::string &  type)
Todo:
tuttle: use INode here !

Definition at line 352 of file Graph.cpp.

References tuttle::host::INode::asImageEffectNode(), tuttle::host::ofx::imageEffect::OfxhImageEffectNode::getContext(), and getNodes().

Here is the call graph for this function:

std::vector< Graph::Node * > tuttle::host::Graph::getNodesByPlugin ( const std::string &  pluginId)
void tuttle::host::Graph::init ( )

Temporary solution ! Prepare the user graph, so we can call getTimeDomain (and maybe others functions) on nodes.

Definition at line 252 of file Graph.cpp.

References _graph.

void tuttle::host::Graph::removeFromInternalGraph ( Node node) [private]
void tuttle::host::Graph::renameNode ( Graph::Node node,
const std::string &  newUniqueName 
)

Rename a node in the current graph.

Parameters:
newUniqueNameis the new unique node name.
Warning:
you will loose all connections.

Definition at line 84 of file Graph.cpp.

References _nodes, addToInternalGraph(), tuttle::host::INode::getName(), tuttle::quotes(), removeFromInternalGraph(), tuttle::host::INode::setName(), TUTTLE_INFO, and TUTTLE_TLOG.

Referenced by main().

Here is the call graph for this function:

void tuttle::host::Graph::setup ( )

Definition at line 302 of file Graph.cpp.

References tuttle::host::graph::ProcessGraph::setup().

Here is the call graph for this function:

void tuttle::host::Graph::setupAtTime ( const OfxTime  time,
const NodeListArg nodes = NodeListArg() 
)

Definition at line 310 of file Graph.cpp.

References tuttle::host::NodeListArg::getNodes(), and tuttle::host::graph::ProcessGraph::setupAtTime().

Here is the call graph for this function:

void tuttle::host::Graph::unconnect ( const Attribute outAttr,
const Attribute inAttr 
)

Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  os,
const Graph g 
) [friend]

Definition at line 409 of file Graph.cpp.


Field Documentation

used to assign a unique name to each node

Definition at line 190 of file Graph.hpp.

Referenced by addNode(), and getInstanceCount().

Definition at line 189 of file Graph.hpp.

Referenced by addNode(), deleteNode(), getNode(), getNodes(), and renameNode().


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