using namespace std;
#include <stdio.h>
#include <fstream>
-#include <strstream>
+//#include <sstream>
#include <string>
-#include "utilities.h"
+//#include "utilities.h"
#include "Graph_Impl.hxx"
// << hex << (void *) this << dec )
// _thisObj = this ;
// _id = _poa->activate_object(_thisObj);
- MESSAGE( "CNode_Impl::CNode_Impl " << aDataFlowName << " " );
+// MESSAGE( "CNode_Impl::CNode_Impl " << aDataFlowName << " " );
beginService( "CNode_Impl::CNode_Impl" );
_Orb = CORBA::ORB::_duplicate(orb);
_Poa = poa ;
const char * FuncName ,
const SUPERV::ListOfStrings & PythonFunction ) :
Engines_Component_i(orb, poa, contId, instanceName, interfaceName, false, false) {
-// beginService( "CNode_Impl::CNode_Impl" );
- if ( FuncName && NodeName ) {
- cout << "CNode_Impl::CNode_Impl " << (void *) NodeName << " " << NodeName
- << " " << strlen(NodeName) << " " << (void *) FuncName << " " << FuncName
- << " " << strlen( FuncName ) << endl ;
- }
+ beginService( "CNode_Impl::CNode_Impl" );
+// cout << "CNode_Impl::CNode_Impl -->" << endl ;
+// if ( FuncName && NodeName ) {
+// cout << "CNode_Impl::CNode_Impl " << (void *) NodeName << " " << NodeName
+// << " " << strlen(NodeName) << " " << (void *) FuncName << " " << FuncName
+// << " " << strlen( FuncName ) << endl ;
+// }
if ( NodeKindOfNode == SUPERV::ComputingNode ) {
MESSAGE( "CNode_Impl::CNode_Impl " << FuncName << " _poa->activate_object" );
_thisObj = this ;
aFuncName ,
aPythonFunction ) ;
_IsNode = true ;
-// endService( "CNode_Impl::CNode_Impl" );
+ endService( "CNode_Impl::CNode_Impl" );
+// cout << "<-- CNode_Impl::CNode_Impl" << endl ;
}
CNode_Impl::CNode_Impl( CORBA::ORB_ptr orb ,
bool sts = false ;
GraphBase::InPort * anInPort ;
if ( _IsNode ) {
- sts = _DataFlowExecutor->ChangeInputData( _DataFlowEditor->Name() ,
+ sts = _DataFlowExecutor->ChangeInputData( _DataFlowNode->Name() ,
ToServiceParameterName ,
*aValue->ToAny() ) ;
anInPort = _DataFlowNode->GetChangeInPort( ToServiceParameterName ) ;
SUPERV::ListOfPorts * CNode_Impl::Ports() {
bool begin = true ;
SUPERV::ListOfPorts_var RetVal = new SUPERV::ListOfPorts ;
-// if ( !_DataFlowNode->IsDataFlowNode() ) {
if ( _IsNode ) {
int i , j ;
RetVal->length( _DataFlowNode->GetNodeInPortsSize() +
_DataFlowNode->GetNodeOutPortsSize() ) ;
for ( i = 0 ; i < _DataFlowNode->GetNodeInPortsSize() ; i++ ) {
GraphBase::InPort * anInPort = _DataFlowNode->GetChangeNodeInPort( i ) ;
- if ( CORBA::is_nil( anInPort->ObjRef() ) ) {
- if ( begin ) {
- beginService( "CNode_Impl::Ports" );
- begin = false ;
- }
+ if ( begin ) {
+ beginService( "CNode_Impl::Ports" );
+ begin = false ;
+ }
+ if ( anInPort->IsLoop() || ( anInPort->IsGate() && !anInPort->IsConnected() &&
+ ( _DataFlowEditor->IsExecuting() || _DataFlowEditor->IsReadOnly() ) ) ) {
+ MESSAGE( "InPort " << i << " " << anInPort->PortName() << " of Node " << Name() << " ignored" ) ;
+ RetVal[ i ] = SUPERV::Port::_duplicate( SUPERV::Port::_narrow( CORBA::Object::_nil() ) ) ;
+ }
+ else if ( CORBA::is_nil( anInPort->ObjRef() ) ) {
+ MESSAGE( "InPort " << i << " " << anInPort->PortName() << " of Node " << Name() << " IsExecuting "
+ << _DataFlowEditor->IsExecuting() << " IsGate/IsConnected " << anInPort->IsGate()
+ << "/" << anInPort->IsConnected() ) ;
Port_Impl * myPort ;
if ( _DataFlowNode->HasInput( anInPort->PortName() ) ) {
const CORBA::Any * anAny = anInPort->GetOutPort()->Value() ;
anInPort->ObjRef( SUPERV::Port::_duplicate( iobject ) ) ;
}
else {
+ MESSAGE( "InPort " << i << " " << anInPort->PortName() << " of Node " << Name() ) ;
RetVal[ i ] = SUPERV::Port::_duplicate( anInPort->ObjRef() ) ;
}
}
for ( i = 0 ; i < _DataFlowNode->GetNodeOutPortsSize() ; i++ ) {
GraphBase::OutPort * anOutPort = _DataFlowNode->GetChangeNodeOutPort( i ) ;
- if ( CORBA::is_nil( anOutPort->ObjRef() ) ) {
- if ( begin ) {
- beginService( "CNode_Impl::Ports" );
- begin = false ;
- }
+ if ( begin ) {
+ beginService( "CNode_Impl::Ports" );
+ begin = false ;
+ }
+ if ( anOutPort->IsLoop() || ( anOutPort->IsGate() && !anOutPort->IsConnected() &&
+ ( _DataFlowEditor->IsExecuting() || _DataFlowEditor->IsReadOnly() ) ) ) {
+ MESSAGE( "OutPort " << i << " " << anOutPort->PortName() << " of Node " << Name() << " ignored" ) ;
+ RetVal[ _DataFlowNode->GetNodeInPortsSize() + i ] = SUPERV::Port::_duplicate( SUPERV::Port::_narrow( CORBA::Object::_nil() ) ) ;
+ }
+ else if ( CORBA::is_nil( anOutPort->ObjRef() ) ) {
+ MESSAGE( "OutPort " << i << " " << anOutPort->PortName() << " of Node " << Name() ) ;
const CORBA::Any * anAny = anOutPort->Value() ;
Port_Impl * myPort = new Port_Impl( _Orb , _Poa , _ContId ,
instanceName() , interfaceName() ,
anOutPort->ObjRef( SUPERV::Port::_duplicate( iobject ) ) ;
}
else {
+ MESSAGE( "OutPort " << i << " " << anOutPort->PortName() << " of Node " << Name() ) ;
RetVal[ _DataFlowNode->GetNodeInPortsSize() + i ] = SUPERV::Port::_duplicate( anOutPort->ObjRef() ) ;
}
}
+ for ( i = 0 ; i < (int ) RetVal->length() ; i++ ) {
+ if ( CORBA::is_nil( RetVal[ i ] ) ) {
+ for ( j = i ; j < (int ) RetVal->length() - 1 ; j++ ) {
+ RetVal[ j ] = RetVal[ j + 1 ] ;
+ }
+ RetVal->length( RetVal->length() - 1 ) ;
+ i-- ;
+ }
+ }
}
else {
if ( _DataFlowEditor->IsValid() ) {
}
bool CNode_Impl::IsLinked(const char * ServiceParameterName ) {
-// beginService( "CNode_Impl::IsLinked" );
+ beginService( "CNode_Impl::IsLinked" );
bool RetVal = _DataFlowNode->IsLinked( ServiceParameterName ) ;
-// endService( "CNode_Impl::IsLinked" );
+ MESSAGE( Name() << "->IsLinked( '" << ServiceParameterName << "' )" ) ;
+ endService( "CNode_Impl::IsLinked" );
return RetVal ;
}
}
void CNode_Impl::ControlClear() {
// beginService( "CNode_Impl::ControlClear" );
- SUPERV::ControlState RetVal = SUPERV::VoidState ;
+// SUPERV::ControlState RetVal = SUPERV::VoidState ;
GraphExecutor::DataFlow * _DataFlowExecutor = _DataFlowEditor->Executor() ;
if ( _DataFlowExecutor ) {
if ( _IsNode ) {
GraphExecutor::DataFlow * _DataFlowExecutor = _DataFlowEditor->Executor() ;
if ( _DataFlowExecutor ) {
if ( _IsNode ) {
-// RetVal = _DataFlowExecutor->CpuUsed( Name() ) ;
+ RetVal = _DataFlowExecutor->CpuUsed( Name() ) ;
}
else {
-// RetVal = _DataFlowExecutor->CpuUsed() ;
+ RetVal = _DataFlowExecutor->CpuUsed() ;
}
}
- else {
- return 0 ;
- }
return RetVal ;
}