StreamGraph()->CreateStreamTopology( "/tmp/" ) ;
}
+ // asv : 13.12.04 : introducing check for compatibility of linked ports' types.
+ if ( !IsLinksCompatible() ) {
+ _Executable = false;
+ }
+
cdebug_out << "GraphEditor::OutNode::Executable" << endl;
return _Executable ;
}
return true ;
}
+/** Iterate through ALL links (OutPort-InPort pairs) and check if their types are
+ * compatible - call GraphEditor::DataFlow::IsCompatible(type1, type2).
+ * Returns true if all are compatible.
+ */
+bool GraphEditor::OutNode::IsLinksCompatible() {
+ const GraphBase::ListOfSLinks * Links = Graph()->GetLinks( true ) ;
+ bool b = true;
+ for ( int i = 0 ; i < (int ) Links->size() && b ; i++ ) {
+ GraphBase::SLink aLink = (*Links)[i];
+ GraphBase::ComputingNode* anOutNode = Graph()->GetChangeGraphNode( aLink.FromNodeName.c_str() );
+ GraphBase::ComputingNode* anInNode = Graph()->GetChangeGraphNode( aLink.ToNodeName.c_str() );
+ const GraphBase::OutPort* anOutPort = anOutNode->GetOutPort( aLink.FromServiceParameterName.c_str() );
+ const GraphBase::InPort* anInPort = anInNode->GetInPort( aLink.ToServiceParameterName.c_str() );
+ b = IsCompatible( anOutPort->PortType(), anInPort->PortType() );
+ cdebug << "GraphEditor::OutNode::IsLinksCompatible: "<<aLink.FromNodeName << "("<<aLink.FromServiceParameterName
+ <<") --> "<<aLink.ToNodeName<<"("<<aLink.ToServiceParameterName<<") = " << (b ? "OK" : "Not compatible (ERROR)") << endl;
+ if ( !b )
+ MESSAGE( "Graph structure ERROR: type of port \""<<aLink.FromServiceParameterName<<"\" of node \""
+ <<aLink.FromNodeName<<"\" is not compatible with type of linked port \""
+ <<aLink.ToServiceParameterName<<"\" of node \""<<aLink.ToNodeName<<"\"" );
+ }
+ return b;
+}
+/**Returns true if an out-port of type "OutPortType" can be bound with in-port of type "InPortType".
+ * Types: {"string", "boolean", "char", "short", "int", "long", "float", "double", "objref"};
+ * Currently considered compatible ALL types except for objref - they must match exactly
+ */
+bool GraphEditor::OutNode::IsCompatible( const char* OutPortType, const char* InPortType ) const {
+ bool ret = true;
+ string t1 = OutPortType;
+ string t2 = InPortType;
+ // if ANY is an objref - the other one must be objref as well
+ if ( ( t1 == "objref" || t2 == "objref" ) && t1 != t2 )
+ ret = false;
+ return ret;
+}
ostream & operator<< (ostream & f,const GraphEditor::OutNode & G) {
f << (GraphBase::ComputingNode ) *(G.Graph()) ;