Vuo  1.2.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Classes | Public Member Functions | Static Public Member Functions | Static Public Attributes | Friends | List of all members
VuoCompilerComposition Class Reference

Description

A collection of nodes and the cables connecting them.

Classes

class  NodeReplacement
 A mapping from a node to its replacement in a composition diff. More...
 

Public Member Functions

 VuoCompilerComposition (VuoComposition *baseComposition, VuoCompilerGraphvizParser *parser)
 Creates a composition.
 
 ~VuoCompilerComposition (void)
 Destructor.
 
void check (const set< string > &subcompositions=set< string >())
 Checks that the composition is valid (able to be compiled).
 
void checkForMissingNodeClasses (const set< string > &subcompositions=set< string >())
 Checks that all of the nodes in the composition have a node class known to the compiler.
 
void checkFeedback (set< VuoCompilerCable * > potentialCables=set< VuoCompilerCable * >())
 Checks that the structure of feedback loops in the composition is valid.
 
void updateGenericPortTypes (void)
 Gives each group/network of connected generic ports a unique generic type.
 
set< set< VuoCompilerPort * > > groupGenericPortsByType (bool useOriginalType)
 Puts the generic ports in the composition into sets, where all ports in a set have the same generic type.
 
set< VuoPort * > getConnectedGenericPorts (VuoPort *port)
 Returns the set of ports that have the same innermost generic type as the given port.
 
void setUniqueGraphvizIdentifierForNode (VuoNode *node)
 If the given node has the same Graphviz identifier as some other node currently in the composition, or a node that was previously passed through this function, changes the given node's Graphviz identifier to one that has never been used by this composition.
 
void setModule (Module *module)
 Takes ownership of the LLVM module containing the compiled composition.
 
string getGraphvizDeclaration (string header="", string footer="")
 Returns the .vuo (Graphviz dot format) representation of this composition.
 
string getGraphvizDeclarationForComponents (set< VuoNode * > nodeSet, set< VuoCable * > cableSet, vector< VuoPublishedPort * > publishedInputPorts, vector< VuoPublishedPort * > publishedOutputPorts, string header="", string footer="", double xPositionOffset=0, double yPositionOffset=0)
 Returns the .vuo (Graphviz dot format) representation of the given nodes and cables in this composition.
 
string diffAgainstOlderComposition (string oldCompositionGraphvizDeclaration, VuoCompiler *compiler, const set< NodeReplacement > &nodeReplacements)
 Returns a string representation of a comparison between the old and the current composition.
 
- Public Member Functions inherited from VuoBaseDetail< VuoComposition >
 VuoBaseDetail (string description, VuoComposition *base)
 Creates a VuoComposition detail class.
 
VuoCompositiongetBase (void) const
 Returns the VuoComposition detail class instance's base class instance.
 
void setBase (VuoComposition *base)
 Sets the VuoComposition detail class instance's base class instance.
 

Static Public Member Functions

static VuoCompilerCompositionnewCompositionFromGraphvizDeclaration (const string &compositionGraphvizDeclaration, VuoCompiler *compiler)
 Creates a composition from the Graphviz-formatted string representation of a composition.
 

Static Public Attributes

static const string defaultGraphDeclaration = "digraph G\n"
 The default graph type and ID to be generated for new .vuo (Graphviz dot format) composition files.
 

Friends

bool operator< (const NodeReplacement &lhs, const NodeReplacement &rhs)
 Needed so this type can be used in STL containers.
 

Class Documentation

class VuoCompilerComposition::NodeReplacement
Class Members
string newNodeIdentifier The Graphviz identifier of the replacement node.
map< string, string > oldAndNewPortIdentifiers A mapping of equivalent port class names from the original node to the replacement node.
string oldNodeIdentifier The Graphviz identifier of the original node.

Constructor & Destructor Documentation

VuoCompilerComposition::VuoCompilerComposition ( VuoComposition baseComposition,
VuoCompilerGraphvizParser parser 
)

Creates a composition.

If a non-null parser is provided, the composition is populated from the parser. Otherwise, the composition is empty.

VuoCompilerComposition::~VuoCompilerComposition ( void  )

Destructor.

Member Function Documentation

void VuoCompilerComposition::check ( const set< string > &  subcompositions = set<string>())

Checks that the composition is valid (able to be compiled).

Exceptions
VuoCompilerExceptionThe composition is invalid.
void VuoCompilerComposition::checkFeedback ( set< VuoCompilerCable * >  potentialCables = set<VuoCompilerCable *>())

Checks that the structure of feedback loops in the composition is valid.

Parameters
potentialCablesCables that are not yet in the composition but should be included in the check.
Exceptions
VuoCompilerExceptionThere is at least one infinite feedback loop or deadlocked feedback loop.
void VuoCompilerComposition::checkForMissingNodeClasses ( const set< string > &  subcompositions = set<string>())

Checks that all of the nodes in the composition have a node class known to the compiler.

Parameters
subcompositionsIf this is a subcomposition, pass the node class names for all subcompositions (loaded or not) known to the compiler. Otherwise, pass an empty set.
Exceptions
VuoCompilerExceptionOne or more nodes have an unknown node class.
string VuoCompilerComposition::diffAgainstOlderComposition ( string  oldCompositionGraphvizDeclaration,
VuoCompiler compiler,
const set< NodeReplacement > &  nodeReplacements 
)

Returns a string representation of a comparison between the old and the current composition.

This needs to be kept in sync with VuoRuntime function isNodeInBothCompositions().

The string representation is based on the JSON Patch format, with some extensions. The key used for each node is its Graphviz identifier. Unlike the example below (spaced for readability), the returned string contains no whitespace.

Example:
[
{"add" : "FireOnStart", "value" : {"nodeClass" : "vuo.event.fireOnStart"}},
{"remove" : "Round"}
]
set< VuoPort * > VuoCompilerComposition::getConnectedGenericPorts ( VuoPort port)

Returns the set of ports that have the same innermost generic type as the given port.

Assumes that updateGenericPortTypes() has been called since any changes affecting the groups/networks of connected generic ports have been made to the composition.

string VuoCompilerComposition::getGraphvizDeclaration ( string  header = "",
string  footer = "" 
)

Returns the .vuo (Graphviz dot format) representation of this composition.

string VuoCompilerComposition::getGraphvizDeclarationForComponents ( set< VuoNode * >  nodeSet,
set< VuoCable * >  cableSet,
vector< VuoPublishedPort * >  publishedInputPorts,
vector< VuoPublishedPort * >  publishedOutputPorts,
string  header = "",
string  footer = "",
double  xPositionOffset = 0,
double  yPositionOffset = 0 
)

Returns the .vuo (Graphviz dot format) representation of the given nodes and cables in this composition.

set< set< VuoCompilerPort * > > VuoCompilerComposition::groupGenericPortsByType ( bool  useOriginalType)

Puts the generic ports in the composition into sets, where all ports in a set have the same generic type.

Parameters
useOriginalTypeIf true, considers a port generic if it's currently generic or if it's specialized from a generic. If false, only looks at ports that are currently generic.
Todo:
https://b33p.net/kosada/node/7655 Handle published ports (node is NULL).
VuoCompilerComposition * VuoCompilerComposition::newCompositionFromGraphvizDeclaration ( const string &  compositionGraphvizDeclaration,
VuoCompiler compiler 
)
static

Creates a composition from the Graphviz-formatted string representation of a composition.

void VuoCompilerComposition::setModule ( Module *  module)

Takes ownership of the LLVM module containing the compiled composition.

void VuoCompilerComposition::setUniqueGraphvizIdentifierForNode ( VuoNode node)

If the given node has the same Graphviz identifier as some other node currently in the composition, or a node that was previously passed through this function, changes the given node's Graphviz identifier to one that has never been used by this composition.

void VuoCompilerComposition::updateGenericPortTypes ( void  )

Gives each group/network of connected generic ports a unique generic type.

This does not update the backing types for the generic types. Before compiling the composition, VuoCompiler::reifyGenericPortTypes() needs to be called to update them.

Friends And Related Function Documentation

bool operator< ( const NodeReplacement lhs,
const NodeReplacement rhs 
)
friend

Needed so this type can be used in STL containers.

Member Data Documentation

const string VuoCompilerComposition::defaultGraphDeclaration = "digraph G\n"
static

The default graph type and ID to be generated for new .vuo (Graphviz dot format) composition files.


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