Vuo  2.0.0
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.

Definition at line 33 of file VuoCompilerComposition.hh.

Public Member Functions

 VuoCompilerComposition (VuoComposition *baseComposition, VuoCompilerGraphvizParser *parser)
 Creates a composition. More...
 
 ~VuoCompilerComposition (void)
 Destructor. More...
 
void getChangesToReplaceNode (VuoNode *oldNode, VuoNode *newNode, map< VuoCable *, VuoPort * > &cablesToTransferFromPort, map< VuoCable *, VuoPort * > &cablesToTransferToPort, set< VuoCable * > &cablesToRemove) const
 Outputs the modifications to cables that would be made by VuoCompilerComposition::replaceNode without actually modifying anything. More...
 
void replaceNode (VuoNode *oldNode, VuoNode *newNode)
 Replaces oldNode with newNode in the composition, transferring all cable and published port connections from oldNode to newNode where port names and data types correspond, and severing the rest. More...
 
VuoCompilerGraphgetCachedGraph (VuoCompiler *compiler=nullptr)
 Returns the graph for this composition, using the most recently generated graph if it still applies. More...
 
void invalidateCachedGraph (void)
 Indicates that the most recently generated graph for this composition no longer applies. More...
 
void check (VuoCompilerIssues *issues)
 Checks that the composition is valid (able to be compiled). More...
 
void checkForMissingNodeClasses (VuoCompilerIssues *issues)
 Checks that all of the nodes in the composition have a node class known to the compiler. More...
 
void checkForEventFlowIssues (VuoCompilerIssues *issues)
 Checks that the event flow in the composition is valid. More...
 
void checkForEventFlowIssues (set< VuoCompilerCable * > potentialCables, VuoCompilerIssues *issues)
 Checks that the event flow in the composition is valid. More...
 
void updateGenericPortTypes (void)
 Gives each group/network of connected generic ports a unique generic type. More...
 
set< VuoPort * > getCorrelatedGenericPorts (VuoNode *entryNode, VuoPort *entryPort, bool useOriginalType)
 Returns the set of ports that have the same innermost generic type as entryPort. More...
 
VuoPortfindNearestUpstreamTriggerPort (VuoNode *node)
 Returns the trigger port that is nearest upstream to node, or null if no trigger is upstream. More...
 
void setModule (Module *module)
 Takes ownership of the LLVM module containing the compiled composition. More...
 
Module * takeModule (void)
 Relinquishes ownership of the LLVM module previously passed to setModule. More...
 
void setUniqueGraphvizIdentifierForNode (VuoNode *node, const string &preferredIdentifier="", const string &identifierPrefix="")
 If the given node has the same Graphviz identifier as another node currently in the composition, a node that was in the composition when it was originally parsed from Graphviz, 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. More...
 
void clearGraphvizNodeIdentifierHistory ()
 Clears the map containing the records of previously used Graphviz node identifiers. More...
 
void setUniqueGraphvizIdentifierForComment (VuoComment *comment)
 If the given comment has the same Graphviz identifier as another comment currently in the composition, a comment that was in the composition when it was originally parsed from Graphviz, or a comment that was previously passed through this function, changes the given comment's Graphviz identifier to one that has never been used by this composition. More...
 
void clearGraphvizCommentIdentifierHistory ()
 Clears the map containing the records of previously used Graphviz comment identifiers. More...
 
void setManuallyFirableInputPort (VuoNode *nodeContainingPort, VuoPort *portFiredInto)
 Selects the input port into which a hidden trigger port can fire events on demand. More...
 
VuoNodegetManuallyFirableInputNode (void)
 Returns the node most recently set by VuoCompilerComposition::setManuallyFirableInputPort(). More...
 
VuoPortgetManuallyFirableInputPort (void)
 Returns the input port most recently set by VuoCompilerComposition::setManuallyFirableInputPort(). More...
 
string getGraphvizDeclaration (VuoProtocol *activeProtocol=NULL, string header="", string footer="")
 Returns the .vuo (Graphviz dot format) representation of this composition. More...
 
string getGraphvizDeclarationForComponents (set< VuoNode * > nodeSet, set< VuoCable * > cableSet, set< VuoComment * > commentSet, 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. More...
 
- Public Member Functions inherited from VuoBaseDetail< VuoComposition >
 VuoBaseDetail (string description, VuoComposition *base)
 Creates a detail class. More...
 
VuoCompositiongetBase (void) const
 Returns the detail class instance's base class instance. More...
 
void setBase (VuoComposition *base)
 Sets the detail class instance's base class instance. More...
 

Static Public Member Functions

static VuoCompilerCompositionnewCompositionFromGraphvizDeclaration (const string &compositionGraphvizDeclaration, VuoCompiler *compiler)
 Creates a composition from the Graphviz-formatted string representation of a composition. More...
 
static bool portsMatch (VuoPort *oldPort, VuoPort *newPort)
 Returns true if a port on an old node corresponds to a port on a new node replacing the old one (same name, same data type). More...
 
static bool portClassesMatch (VuoPortClass *oldPortClass, VuoPortClass *newPortClass)
 Returns true if a port on an old node class corresponds to a port on a new node class replacing the old one (same name, same data type). More...
 

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. More...
 
static const string topLevelCompositionIdentifier = "Top"
 The key of the top-level composition when looking up node contexts. More...
 

Friends

class TestCompilingAndLinking
 

Constructor & Destructor Documentation

◆ VuoCompilerComposition()

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.

Definition at line 40 of file VuoCompilerComposition.cc.

◆ ~VuoCompilerComposition()

VuoCompilerComposition::~VuoCompilerComposition ( void  )

Destructor.

Definition at line 89 of file VuoCompilerComposition.cc.

Member Function Documentation

◆ check()

void VuoCompilerComposition::check ( VuoCompilerIssues issues)

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

Parameters
issuesAny issues found are appended to this.
Exceptions
VuoCompilerExceptionThe composition is invalid.

Definition at line 227 of file VuoCompilerComposition.cc.

◆ checkForEventFlowIssues() [1/2]

void VuoCompilerComposition::checkForEventFlowIssues ( set< VuoCompilerCable * >  potentialCables,
VuoCompilerIssues issues 
)

Checks that the event flow in the composition is valid.

Parameters
potentialCablesCables that are not yet in the composition but should be included in the check.
issuesAny issues found are appended to this.
Exceptions
VuoCompilerExceptionThere is an infinite or deadlocked feedback loop.

Definition at line 385 of file VuoCompilerComposition.cc.

◆ checkForEventFlowIssues() [2/2]

void VuoCompilerComposition::checkForEventFlowIssues ( VuoCompilerIssues issues)

Checks that the event flow in the composition is valid.

Parameters
issuesAny issues found are appended to this.
Exceptions
VuoCompilerExceptionThere is an infinite or deadlocked feedback loop.

Definition at line 373 of file VuoCompilerComposition.cc.

◆ checkForMissingNodeClasses()

void VuoCompilerComposition::checkForMissingNodeClasses ( VuoCompilerIssues issues)

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

Parameters
issuesAny issues found are appended to this.
Exceptions
VuoCompilerExceptionOne or more nodes have an unknown node class.

Definition at line 240 of file VuoCompilerComposition.cc.

◆ clearGraphvizCommentIdentifierHistory()

void VuoCompilerComposition::clearGraphvizCommentIdentifierHistory ( )

Clears the map containing the records of previously used Graphviz comment identifiers.

Definition at line 824 of file VuoCompilerComposition.cc.

◆ clearGraphvizNodeIdentifierHistory()

void VuoCompilerComposition::clearGraphvizNodeIdentifierHistory ( )

Clears the map containing the records of previously used Graphviz node identifiers.

Definition at line 785 of file VuoCompilerComposition.cc.

◆ findNearestUpstreamTriggerPort()

VuoPort * VuoCompilerComposition::findNearestUpstreamTriggerPort ( VuoNode node)

Returns the trigger port that is nearest upstream to node, or null if no trigger is upstream.

Definition at line 724 of file VuoCompilerComposition.cc.

◆ getCachedGraph()

VuoCompilerGraph * VuoCompilerComposition::getCachedGraph ( VuoCompiler compiler = nullptr)

Returns the graph for this composition, using the most recently generated graph if it still applies.

Definition at line 188 of file VuoCompilerComposition.cc.

◆ getChangesToReplaceNode()

void VuoCompilerComposition::getChangesToReplaceNode ( VuoNode oldNode,
VuoNode newNode,
map< VuoCable *, VuoPort * > &  cablesToTransferFromPort,
map< VuoCable *, VuoPort * > &  cablesToTransferToPort,
set< VuoCable * > &  cablesToRemove 
) const

Outputs the modifications to cables that would be made by VuoCompilerComposition::replaceNode without actually modifying anything.

Definition at line 112 of file VuoCompilerComposition.cc.

◆ getCorrelatedGenericPorts()

set< VuoPort * > VuoCompilerComposition::getCorrelatedGenericPorts ( VuoNode entryNode,
VuoPort entryPort,
bool  useOriginalType 
)

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

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

Parameters
entryNodeThe node containing entryPort.
entryPortThe port whose type is to be matched in the returned ports.
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.

Definition at line 624 of file VuoCompilerComposition.cc.

◆ getGraphvizDeclaration()

string VuoCompilerComposition::getGraphvizDeclaration ( VuoProtocol activeProtocol = NULL,
string  header = "",
string  footer = "" 
)

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

Definition at line 861 of file VuoCompilerComposition.cc.

◆ getGraphvizDeclarationForComponents()

string VuoCompilerComposition::getGraphvizDeclarationForComponents ( set< VuoNode * >  nodeSet,
set< VuoCable * >  cableSet,
set< VuoComment * >  commentSet,
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.

Definition at line 875 of file VuoCompilerComposition.cc.

◆ getManuallyFirableInputNode()

VuoNode * VuoCompilerComposition::getManuallyFirableInputNode ( void  )

Returns the node most recently set by VuoCompilerComposition::setManuallyFirableInputPort().

Definition at line 845 of file VuoCompilerComposition.cc.

◆ getManuallyFirableInputPort()

VuoPort * VuoCompilerComposition::getManuallyFirableInputPort ( void  )

Returns the input port most recently set by VuoCompilerComposition::setManuallyFirableInputPort().

Definition at line 853 of file VuoCompilerComposition.cc.

◆ invalidateCachedGraph()

void VuoCompilerComposition::invalidateCachedGraph ( void  )

Indicates that the most recently generated graph for this composition no longer applies.

Definition at line 214 of file VuoCompilerComposition.cc.

◆ newCompositionFromGraphvizDeclaration()

VuoCompilerComposition * VuoCompilerComposition::newCompositionFromGraphvizDeclaration ( const string &  compositionGraphvizDeclaration,
VuoCompiler compiler 
)
static

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

Exceptions
VuoCompilerExceptionCouldn't parse the composition.

Definition at line 100 of file VuoCompilerComposition.cc.

◆ portClassesMatch()

bool VuoCompilerComposition::portClassesMatch ( VuoPortClass oldPortClass,
VuoPortClass newPortClass 
)
static

Returns true if a port on an old node class corresponds to a port on a new node class replacing the old one (same name, same data type).

Definition at line 1040 of file VuoCompilerComposition.cc.

◆ portsMatch()

bool VuoCompilerComposition::portsMatch ( VuoPort oldPort,
VuoPort newPort 
)
static

Returns true if a port on an old node corresponds to a port on a new node replacing the old one (same name, same data type).

Definition at line 1013 of file VuoCompilerComposition.cc.

◆ replaceNode()

void VuoCompilerComposition::replaceNode ( VuoNode oldNode,
VuoNode newNode 
)

Replaces oldNode with newNode in the composition, transferring all cable and published port connections from oldNode to newNode where port names and data types correspond, and severing the rest.

If oldNode or newNode lacks a compiler detail (its node class is not loaded), then cables are transferred where port names correspond.

Definition at line 166 of file VuoCompilerComposition.cc.

◆ setManuallyFirableInputPort()

void VuoCompilerComposition::setManuallyFirableInputPort ( VuoNode nodeContainingPort,
VuoPort portFiredInto 
)

Selects the input port into which a hidden trigger port can fire events on demand.

The trigger port and the cable from it to portFiredInto are not included in the lists of nodes or cables stored in the VuoComposition. The trigger port can be accessed with VuoCompilerGraph::getManuallyFirableTrigger().

Definition at line 836 of file VuoCompilerComposition.cc.

◆ setModule()

void VuoCompilerComposition::setModule ( Module *  module)

Takes ownership of the LLVM module containing the compiled composition.

Definition at line 734 of file VuoCompilerComposition.cc.

◆ setUniqueGraphvizIdentifierForComment()

void VuoCompilerComposition::setUniqueGraphvizIdentifierForComment ( VuoComment comment)

If the given comment has the same Graphviz identifier as another comment currently in the composition, a comment that was in the composition when it was originally parsed from Graphviz, or a comment that was previously passed through this function, changes the given comment's Graphviz identifier to one that has never been used by this composition.

Definition at line 796 of file VuoCompilerComposition.cc.

◆ setUniqueGraphvizIdentifierForNode()

void VuoCompilerComposition::setUniqueGraphvizIdentifierForNode ( VuoNode node,
const string &  preferredIdentifier = "",
const string &  identifierPrefix = "" 
)

If the given node has the same Graphviz identifier as another node currently in the composition, a node that was in the composition when it was originally parsed from Graphviz, 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.

Definition at line 755 of file VuoCompilerComposition.cc.

◆ takeModule()

Module * VuoCompilerComposition::takeModule ( void  )

Relinquishes ownership of the LLVM module previously passed to setModule.

Definition at line 742 of file VuoCompilerComposition.cc.

◆ updateGenericPortTypes()

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.

Definition at line 499 of file VuoCompilerComposition.cc.

Member Data Documentation

◆ defaultGraphDeclaration

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.

Definition at line 67 of file VuoCompilerComposition.hh.

◆ topLevelCompositionIdentifier

const string VuoCompilerComposition::topLevelCompositionIdentifier = "Top"
static

The key of the top-level composition when looking up node contexts.

Definition at line 68 of file VuoCompilerComposition.hh.


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