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.
std::size_t deleteUnconnectedNodes (const Node &node)
 Delete all unconnected nodes from the current graph.
void clear ()
 Delete all nodes 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())
bool compute (const NodeListArg &nodes, const ComputeOptions &options=ComputeOptions())
bool compute (memory::IMemoryCache &memoryCache, const ComputeOptions &options)
bool compute (memory::IMemoryCache &memoryCache, const NodeListArg &nodes=NodeListArg(), const ComputeOptions &options=ComputeOptions())
bool compute (memory::IMemoryCache &memoryCache, const NodeListArg &nodes, const ComputeOptions &options, memory::IMemoryCache &internMemoryCache)
const InternalGraphImplgetGraph () const
const NodeMapgetNodesMap () const
NodeMapgetNodesMap ()
std::vector< const Node * > getNodes () const
std::vector< Node * > getNodes ()
std::vector< Node * > getConnectedNodes (const Node &node)
std::vector< Node * > getUnconnectedNodes (const Node &node)
std::size_t getNbNodes () const
std::size_t getNbConnections () const
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 _nodesMap
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 37 of file Graph.hpp.


Member Typedef Documentation

Todo:
tuttle INode...

Definition at line 43 of file Graph.hpp.

Definition at line 41 of file Graph.hpp.

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

Definition at line 48 of file Graph.hpp.

Definition at line 42 of file Graph.hpp.

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

Definition at line 49 of file Graph.hpp.

Definition at line 40 of file Graph.hpp.


Member Enumeration Documentation

Enumerator:
eDotExportLevelSimple 
eDotExportLevelDetailed 

Definition at line 208 of file Graph.hpp.


Constructor & Destructor Documentation

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

Definition at line 21 of file Graph.cpp.

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

Definition at line 24 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 78 of file Graph.cpp.

References addNodes(), and connect().

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

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 49 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 54 of file Graph.cpp.

References _instanceCount, _nodesMap, 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 67 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 123 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:

void tuttle::host::Graph::clear ( )

Delete all nodes from the current graph. This will remove all the connections.

Definition at line 159 of file Graph.cpp.

References _graph, _instanceCount, _nodesMap, and tuttle::host::graph::InternalGraph< VERTEX, EDGE, OutEdgeList, VertexList, EdgeList >::clear().

Here is the call graph for this function:

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

Definition at line 350 of file Graph.cpp.

References compute().

Here is the call graph for this function:

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

Definition at line 358 of file Graph.cpp.

References compute().

Here is the call graph for this function:

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

Definition at line 363 of file Graph.cpp.

References compute(), and tuttle::host::core().

Here is the call graph for this function:

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

Definition at line 368 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() 
)
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 166 of file Graph.cpp.

References getNode().

Referenced by addConnectedNodes(), BOOST_AUTO_TEST_CASE(), connect(), 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 171 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 189 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 194 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 212 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 27 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 43 of file Graph.cpp.

References addNode().

Referenced by BOOST_AUTO_TEST_CASE(), createInputBuffer(), createOutputBuffer(), and tuttle::host::io::getBestReader().

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 35 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 137 of file Graph.cpp.

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

Referenced by deleteUnconnectedNodes().

Here is the call graph for this function:

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

Definition at line 477 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 184 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 205 of file Graph.hpp.

References _instanceCount.

std::size_t tuttle::host::Graph::getNbConnections ( ) const [inline]

Definition at line 196 of file Graph.hpp.

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

Here is the call graph for this function:

std::size_t tuttle::host::Graph::getNbInputConnections ( const Node node) const
std::size_t tuttle::host::Graph::getNbNodes ( ) const [inline]

Definition at line 195 of file Graph.hpp.

References _nodesMap.

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 202 of file Graph.hpp.

References _nodesMap.

Referenced by BOOST_AUTO_TEST_CASE(), and connect().

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

Definition at line 203 of file Graph.hpp.

References getNodesMap().

Here is the call graph for this function:

std::vector< const Graph::Node * > tuttle::host::Graph::getNodes ( ) const

Definition at line 379 of file Graph.cpp.

References getNodesMap().

Here is the call graph for this function:

std::vector< Graph::Node * > tuttle::host::Graph::getNodes ( )

Definition at line 392 of file Graph.cpp.

References getNodesMap().

Here is the call graph for this function:

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

Definition at line 433 of file Graph.cpp.

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

Here is the call graph for this function:

std::vector< Graph::Node * > tuttle::host::Graph::getNodesByPlugin ( const std::string &  pluginId)
const NodeMap& tuttle::host::Graph::getNodesMap ( ) const [inline]

Definition at line 186 of file Graph.hpp.

References _nodesMap.

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

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

Definition at line 187 of file Graph.hpp.

References _nodesMap.

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 271 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 86 of file Graph.cpp.

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

Here is the call graph for this function:

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

Definition at line 321 of file Graph.cpp.

References tuttle::host::core(), and tuttle::host::graph::ProcessGraph::setup().

Referenced by tuttle::host::io::getBestReader(), and tuttle::host::loadAndGenerateThumbnail().

Here is the call graph for this function:

void tuttle::host::Graph::setupAtTime ( const OfxTime  time,
const NodeListArg nodes = NodeListArg() 
)
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 490 of file Graph.cpp.


Field Documentation

used to assign a unique name to each node

Definition at line 219 of file Graph.hpp.

Referenced by addNode(), clear(), and getInstanceCount().


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