--- /dev/null
+// SUPERV Supervision : contains the implementation of interfaces of SuperVision described in SUPERV.idl
+//
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+//
+//
+//
+// File : StreamGraph_Impl.cxx
+// Author : Jean Rahuel
+// Module : SUPERV
+// $Header:
+
+using namespace std;
+
+#include "StreamGraph_Impl.hxx"
+
+StreamGraph_Impl::StreamGraph_Impl( CORBA::ORB_ptr orb ,
+ PortableServer::POA_ptr poa ,
+ PortableServer::ObjectId * contId ,
+ const char *instanceName ,
+ const char *interfaceName ,
+ const char *aDataFlowName ) :
+ Graph_Impl(orb, poa, contId, instanceName, interfaceName, aDataFlowName , SUPERV::DataStreamGraph ) {
+// MESSAGE("StreamGraph_Impl::StreamGraph_Impl activate object instanceName("
+// << instanceName << ") interfaceName(" << interfaceName << ") --> "
+// << hex << (void *) this << dec )
+ beginService( "StreamGraph_Impl::StreamGraph_Impl" );
+ _thisObj = this ;
+ _id = _poa->activate_object(_thisObj);
+ _Orb = CORBA::ORB::_duplicate(orb);
+ _Poa = poa ;
+ _ContId = contId ;
+
+ endService( "StreamGraph_Impl::StreamGraph_Impl" );
+}
+
+StreamGraph_Impl::StreamGraph_Impl() {
+}
+
+StreamGraph_Impl::~StreamGraph_Impl() {
+ beginService( "StreamGraph_Impl::~StreamGraph_Impl" );
+ endService( "StreamGraph_Impl::~StreamGraph_Impl" );
+}
+
+void StreamGraph_Impl::destroy() {
+ beginService( "StreamGraph_Impl::destroy" );
+ _poa->deactivate_object(*_id) ;
+ CORBA::release(_poa) ;
+ delete(_id) ;
+ _thisObj->_remove_ref();
+ endService( "StreamGraph_Impl::destroy" );
+}
+
+SUPERV::StreamGraph_ptr StreamGraph_Impl::StreamCopy() {
+ beginService( "StreamGraph_Impl::StreamCopy" );
+ StreamGraph_Impl * myStreamGraph ;
+ myStreamGraph = new StreamGraph_Impl( _Orb , _Poa, _ContId,
+ instanceName() , interfaceName() ,
+ DataFlowEditor()->Graph()->Name() ) ;
+ PortableServer::ObjectId * id = myStreamGraph->getId() ;
+ CORBA::Object_var obj = _poa->id_to_reference(*id);
+ SUPERV::StreamGraph_var iobject ;
+ iobject = SUPERV::StreamGraph::_narrow(obj) ;
+ GraphBase::SGraph * aSGraph = GetGraph() ;
+ myStreamGraph->LoadGraph( aSGraph ) ;
+ endService( "StreamGraph_Impl::StreamCopy" );
+ return SUPERV::StreamGraph::_duplicate(iobject) ;
+}
+
+SUPERV::StreamLink_ptr StreamGraph_Impl::StreamLink( SUPERV::StreamPort_ptr OutStreamPort ,
+ SUPERV::StreamPort_ptr InStreamPort ) {
+ beginService( "StreamGraph_Impl::StreamLink" );
+ SUPERV::StreamLink_var iobject = SUPERV::StreamLink::_nil() ;
+ if ( DataFlowEditor()->IsEditing() &&
+ !DataFlowEditor()->IsReadOnly() ) {
+ const char * DataFlowOutNodeName = OutStreamPort->Node()->Name() ;
+ GraphEditor::InNode * DataFlowOutNode = DataFlowEditor()->GetNode( DataFlowOutNodeName ) ;
+ const char * DataFlowInNodeName = InStreamPort->Node()->Name() ;
+ GraphEditor::InNode * DataFlowInNode = DataFlowEditor()->GetNode( DataFlowInNodeName ) ;
+ if ( DataFlowOutNode && DataFlowInNode ) {
+ StreamLink_Impl * myStreamLink = new StreamLink_Impl( _Orb , _Poa , _ContId ,
+ instanceName() , interfaceName() ,
+ DataFlowEditor() ,
+ DataFlowInNode ,
+ InStreamPort->Name() ,
+ DataFlowOutNode ,
+ OutStreamPort->Name() ,
+ true ) ;
+ PortableServer::ObjectId * id = myStreamLink->getId() ;
+ CORBA::Object_var obj = _poa->id_to_reference(*id);
+ iobject = SUPERV::StreamLink::_narrow(obj) ;
+ }
+ }
+ endService( "StreamGraph_Impl::StreamLink" );
+ return SUPERV::StreamLink::_duplicate(iobject) ;
+}
+
+SUPERV::ListOfStreamLinks * StreamGraph_Impl::GStreamLinks() {
+ return StreamLinks( NULL , NULL ) ;
+}
+
+SUPERV::ListOfStreamLinks * StreamGraph_Impl::StreamLinks( GraphBase::ComputingNode * theNode ,
+ const char * anInputParam ) {
+ bool begin = true ;
+ SUPERV::ListOfStreamLinks_var RetVal = new SUPERV::ListOfStreamLinks ;
+ int i , j , countlink ;
+ countlink = 0 ;
+ for ( i = 0 ; i < DataFlowEditor()->Graph()->GraphNodesSize() ; i++ ) {
+ GraphEditor::InNode * aNode = NULL ;
+ aNode = (GraphEditor::InNode * ) DataFlowEditor()->Graph()->GraphNodes( i )->GetInNode() ;
+ bool ToProcess = false ;
+ if ( theNode == NULL ) {
+ ToProcess = true ;
+ }
+ else {
+ if ( !strcmp( theNode->Name() , aNode->Name() ) ) {
+ if ( !theNode->IsEndSwitchNode() ) {
+ ToProcess = true ;
+ }
+ }
+ else if ( theNode->IsEndSwitchNode() ) {
+ ToProcess = true ;
+ }
+ }
+ if ( ToProcess ) {
+ for ( j = 0 ; j < aNode->GetNodeInPortsSize() ; j++ ) {
+ GraphBase::InPort * anInPort = NULL ;
+ anInPort = aNode->GetChangeNodeInPort( j ) ;
+ if ( anInputParam == NULL ||
+ !strcmp( anInPort->PortName() , anInputParam ) ) {
+ GraphBase::OutPort * anOutPort = NULL ;
+ anOutPort = anInPort->GetOutPort() ;
+ if ( anOutPort && anOutPort->IsDataStream() ) {
+ if ( strcmp( anOutPort->NodeName() , Name() ) ) {
+ MESSAGE("StreamGraph_Impl::StreamLinks " << anOutPort->NodeName() << "("
+ << anOutPort->PortName() << ") --> " << aNode->Name() << "("
+ << anInPort->PortName() << ")" ) ;
+ if ( theNode == NULL ||
+ ( theNode != NULL && !theNode->IsEndSwitchNode() &&
+ !strcmp( theNode->Name() , aNode->Name() ) ) ) {
+ if ( anInPort->IsLoop() || anOutPort->IsLoop() ||
+ ( aNode->IsEndLoopNode() && !strcmp( aNode->CoupledNode()->Name() ,
+ anOutPort->NodeName() ) ) ) {
+ MESSAGE( "StreamLink " << anOutPort->NodeName() << "("
+ << anOutPort->PortName() << ") --> " << aNode->Name() << "("
+ << anInPort->PortName() << ")" << " ignored" ) ;
+ }
+ else if ( CORBA::is_nil( anOutPort->InPortObjRef( anInPort ) ) ) {
+ if ( begin ) {
+ beginService( "StreamGraph_Impl::StreamLinks" );
+ begin = false ;
+ }
+ GraphEditor::InNode * anOutNode = NULL ;
+ anOutNode = (GraphEditor::InNode * ) DataFlowEditor()->Graph()->GetChangeGraphNode( anOutPort->NodeName() )->GetInNode() ;
+ if ( anOutNode ) {
+ StreamLink_Impl * myStreamLink = new StreamLink_Impl(
+ _Orb , _Poa , _ContId ,
+ instanceName() , interfaceName() ,
+ DataFlowEditor() ,
+ aNode ,
+ anInPort->PortName() ,
+ anOutNode ,
+ anOutPort->PortName() ,
+ false ) ;
+ PortableServer::ObjectId * id = myStreamLink->getId() ;
+ CORBA::Object_var obj = _poa->id_to_reference(*id);
+ SUPERV::StreamLink_var iobject ;
+ iobject = SUPERV::StreamLink::_narrow(obj) ;
+ RetVal->length( countlink + 1 ) ;
+ RetVal[ countlink++ ] = SUPERV::StreamLink::_duplicate( iobject ) ;
+ anOutPort->AddInPortObjRef( anInPort , SUPERV::StreamLink::_duplicate( iobject ) ) ;
+ MESSAGE( "Link" << countlink-1 << " "
+ << RetVal[countlink-1]->OutStreamPort()->Node()->Name() << "("
+ << RetVal[countlink-1]->OutStreamPort()->Name() << ") --> "
+ << RetVal[countlink-1]->InStreamPort()->Node()->Name() << "("
+ << RetVal[countlink-1]->InStreamPort()->Name() << ")" ) ;
+ }
+ }
+ else {
+ RetVal->length( countlink + 1 ) ;
+ RetVal[ countlink++ ] = SUPERV::StreamLink::_duplicate( SUPERV::StreamLink::_narrow( anOutPort->InPortObjRef( anInPort ) ) ) ;
+ MESSAGE( "Link" << countlink-1 << " "
+ << RetVal[countlink-1]->OutStreamPort()->Node()->Name() << "("
+ << RetVal[countlink-1]->OutStreamPort()->Name() << ") --> "
+ << RetVal[countlink-1]->InStreamPort()->Node()->Name() << "("
+ << RetVal[countlink-1]->InStreamPort()->Name() << ")" ) ;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ for ( j = 0 ; j < aNode->GetNodeOutPortsSize() ; j++ ) {
+ GraphBase::OutPort * anOutPort = aNode->GetChangeNodeOutPort( j ) ;
+ int k ;
+ for ( k = 0 ; k < anOutPort->InPortsSize() ; k++ ) {
+ GraphBase::InPort * anInPort = anOutPort->ChangeInPorts( k ) ;
+ GraphEditor::InNode * toNode = (GraphEditor::InNode * ) DataFlowEditor()->Graph()->GetChangeGraphNode( anInPort->NodeName() )->GetInNode() ;
+ if ( theNode == NULL ||
+ !strcmp( theNode->Name() , aNode->Name() ) ) {
+ if ( anInPort->IsDataStream() ) {
+ if ( theNode || ( toNode->IsEndSwitchNode() && !aNode->IsSwitchNode() ) ) {
+ if ( anInputParam == NULL ||
+ !strcmp( anInPort->PortName() , anInputParam ) ) {
+ if ( anInPort->IsLoop() || anOutPort->IsLoop() ||
+ ( toNode->IsEndLoopNode() && !strcmp( toNode->CoupledNode()->Name() ,
+ anOutPort->NodeName() ) ) ) {
+ MESSAGE( "StreamLink " << anOutPort->NodeName() << "("
+ << anOutPort->PortName() << ") --> " << toNode->Name() << "("
+ << anInPort->PortName() << ")" << " ignored" ) ;
+ }
+ else if ( CORBA::is_nil( anOutPort->InPortObjRef( anInPort ) ) ) {
+ if ( begin ) {
+ beginService( "Graph_Impl::StreamLinks" );
+ begin = false ;
+ }
+ StreamLink_Impl * myStreamLink = new StreamLink_Impl(
+ _Orb , _Poa , _ContId ,
+ instanceName() , interfaceName() ,
+ DataFlowEditor() ,
+ toNode ,
+ anInPort->PortName() ,
+ aNode ,
+ anOutPort->PortName() ,
+ false ) ;
+ PortableServer::ObjectId * id = myStreamLink->getId() ;
+ CORBA::Object_var obj = _poa->id_to_reference(*id);
+ SUPERV::StreamLink_var iobject ;
+ iobject = SUPERV::StreamLink::_narrow(obj) ;
+ RetVal->length( countlink + 1 ) ;
+ RetVal[ countlink++ ] = SUPERV::StreamLink::_duplicate( iobject ) ;
+ anOutPort->AddInPortObjRef( anInPort , SUPERV::StreamLink::_duplicate( iobject ) ) ;
+ }
+ else {
+ RetVal->length( countlink + 1 ) ;
+ RetVal[ countlink++ ] = SUPERV::StreamLink::_duplicate( SUPERV::StreamLink::_narrow( anOutPort->InPortObjRef( anInPort ) ) ) ;
+ }
+ MESSAGE( "StreamLink " << anOutPort->NodeName() << "("
+ << anOutPort->PortName() << ") --> " << toNode->Name() << "("
+ << anInPort->PortName() << ")" << " selected" ) ;
+ }
+ else {
+ MESSAGE( "StreamLink " << anOutPort->NodeName() << "("
+ << anOutPort->PortName() << ") --> " << toNode->Name() << "("
+ << anInPort->PortName() << ")" << " skipped" ) ;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+//#if 0
+ const char * NodeName = "" ;
+ const char * InputParamName = "" ;
+ if ( theNode ) {
+ NodeName = theNode->Name() ;
+ }
+ if ( anInputParam ) {
+ InputParamName = anInputParam ;
+ }
+ MESSAGE( RetVal->length() << " StreamLinks of Node " << NodeName << " and of InPort " << InputParamName ) ;
+ for ( i = 0 ; i < (int ) RetVal->length() ; i++ ) {
+ MESSAGE( "Link" << i << " " << RetVal[i]->OutStreamPort()->Node()->Name() << "("
+ << RetVal[i]->OutStreamPort()->Name() << ") --> "
+ << RetVal[i]->InStreamPort()->Node()->Name() << "("
+ << RetVal[i]->InStreamPort()->Name() << ")" ) ;
+ }
+//#endif
+ if ( !begin ) {
+ endService( "StreamGraph_Impl::StreamLinks" );
+ }
+ return ( RetVal._retn() ) ;
+}
+
+bool StreamGraph_Impl::SetStreamParams( const long Timeout ,
+ const SUPERV::KindOfDataStreamTrace DataStreamTrace ,
+ const double DeltaTime ) {
+ return DataFlowEditor()->StreamGraph()->SetStreamParams( Timeout , DataStreamTrace , DeltaTime ) ;
+}
+
+void StreamGraph_Impl::StreamParams( long & Timeout ,
+ SUPERV::KindOfDataStreamTrace & DataStreamTrace ,
+ double & DeltaTime ) {
+ DataFlowEditor()->StreamGraph()->StreamParams( Timeout , DataStreamTrace , DeltaTime ) ;
+}
+
+SUPERV::Graph_ptr StreamGraph_Impl::ToFlowGraph() {
+ SUPERV::Graph_var iobject = SUPERV::Graph::_nil() ;
+ beginService( "StreamGraph_Impl::ToFlowGraph" );
+// Graph_Impl * myFlowGraph = new Graph_Impl( _Orb , _Poa , _ContId ,
+// instanceName() , interfaceName() ) ;
+// PortableServer::ObjectId * id = myFlowGraph->getId() ;
+// CORBA::Object_var obj = _poa->id_to_reference(*id);
+// iobject = SUPERV::Graph::_narrow(obj) ;
+ endService( "StreamGraph_Impl::ToFlowGraph" );
+ return SUPERV::Graph::_duplicate( iobject ) ;
+}
+
+bool StreamGraph_Impl::StreamMerge(const SUPERV::StreamGraph_ptr aGraph ) {
+ beginService( "StreamGraph_Impl::StreamMerge" );
+ bool RetVal = true ;
+ endService( "StreamGraph_Impl::StreamMerge" );
+ return RetVal ;
+}
+
--- /dev/null
+// SUPERV Supervision : contains the implementation of interfaces of SuperVision described in SUPERV.idl
+//
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+//
+//
+//
+// File : StreamGraph_Impl.hxx
+// Author : Jean Rahuel
+// Module : SUPERV
+// $Header:
+
+#ifndef _STREAMGRAPH_IMPL_HXX_
+#define _STREAMGRAPH_IMPL_HXX_
+
+//#include <iostream.h>
+
+#include "CORBA.h"
+
+#include <SALOMEconfig.h>
+#include "SALOME_Component_i.hxx"
+#include "SALOME_LifeCycleCORBA.hxx"
+
+#include "Graph_Impl.hxx"
+
+class StreamGraph_Impl : public Graph_Impl ,
+ public POA_SUPERV::StreamGraph {
+ private:
+
+ CORBA::ORB_ptr _Orb ;
+ PortableServer::POA_ptr _Poa ;
+ PortableServer::ObjectId * _ContId ;
+
+ public:
+ StreamGraph_Impl();
+ StreamGraph_Impl( CORBA::ORB_ptr orb ,
+ PortableServer::POA_ptr poa ,
+ PortableServer::ObjectId * contId ,
+ const char *instanceName ,
+ const char *interfaceName ,
+ const char *aDataFlowName ) ;
+
+ virtual ~StreamGraph_Impl() ;
+ virtual void destroy() ;
+
+ virtual SUPERV::StreamGraph_ptr StreamCopy() ;
+
+ virtual SUPERV::StreamLink_ptr StreamLink( SUPERV::StreamPort_ptr OutStreamPort ,
+ SUPERV::StreamPort_ptr InStreamPort ) ;
+
+ virtual SUPERV::ListOfStreamLinks * GStreamLinks() ;
+
+ virtual SUPERV::ListOfStreamLinks * StreamLinks( GraphBase::ComputingNode * aNode ,
+ const char * anInputParam ) ;
+
+ virtual bool SetStreamParams( const long Timeout ,
+ const SUPERV::KindOfDataStreamTrace DataStreamTrace ,
+ const double DeltaTime ) ;
+ virtual void StreamParams( long & Timeout ,
+ SUPERV::KindOfDataStreamTrace & DataStreamTrace ,
+ double & DeltaTime ) ;
+
+ virtual SUPERV::Graph_ptr ToFlowGraph() ;
+
+ bool StreamMerge( const SUPERV::StreamGraph_ptr aStreamGraph ) ;
+
+};
+
+
+#endif
--- /dev/null
+// SUPERV Supervision : contains the implementation of interfaces of SuperVision described in SUPERV.idl
+//
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+//
+//
+//
+// File : StreamLink_Impl.cxx
+// Author : Jean Rahuel
+// Module : SUPERV
+// $Header:
+
+using namespace std;
+
+#include "StreamLink_Impl.hxx"
+
+StreamLink_Impl::StreamLink_Impl( CORBA::ORB_ptr orb ,
+ PortableServer::POA_ptr poa ,
+ PortableServer::ObjectId * contId ,
+ const char *instanceName ,
+ const char *interfaceName ,
+ GraphEditor::DataFlow * DataFlowEditor ,
+ GraphEditor::InNode * DataFlowNode ,
+ const char *InputParameterName ,
+ GraphEditor::InNode * DataFlowOutNode ,
+ const char *OutputParameterName ,
+ const bool Create ) :
+ Link_Impl( orb , poa , contId , instanceName , interfaceName , DataFlowEditor ,
+ DataFlowNode , InputParameterName , DataFlowOutNode ,
+ OutputParameterName , false , false ) {
+// MESSAGE("StreamLink_Impl::StreamLink_Impl activate object instanceName("
+// << instanceName << ") interfaceName(" << interfaceName << ") --> "
+// << hex << (void *) this << dec )
+ bool linksts ;
+// beginService( "StreamLink_Impl::Link_Impl" );
+ _Orb = CORBA::ORB::_duplicate(orb);
+ _Poa = poa ;
+ _ContId = contId ;
+ if ( Create ) {
+ linksts = DataFlowEditor->AddLink( DataFlowOutNode->Name() ,
+ OutputParameterName ,
+ DataFlowNode->Name() ,
+ InputParameterName ) ;
+ }
+ else {
+ char * DataFlowOutNodeName = NULL ;
+ char * OutParamName = NULL ;
+ linksts = DataFlowEditor->GetLink( DataFlowNode->Name() ,
+ InputParameterName ,
+ &DataFlowOutNodeName ,
+ &OutParamName ) ;
+ }
+ _thisObj = this ;
+ _id = _poa->activate_object(_thisObj);
+// endService( "StreamLink_Impl::Link_Impl" );
+}
+
+StreamLink_Impl::StreamLink_Impl() {
+}
+
+StreamLink_Impl::~StreamLink_Impl() {
+ beginService( "Link_Impl::~Link_Impl" );
+ endService( "Link_Impl::~Link_Impl" );
+}
+
+void StreamLink_Impl::destroy() {
+ beginService( "StreamLink_Impl::destroy" );
+ Delete() ;
+ _poa->deactivate_object(*_id) ;
+ CORBA::release(_poa) ;
+ delete(_id) ;
+ _thisObj->_remove_ref();
+ endService( "StreamLink_Impl::destroy" );
+}
+
+bool StreamLink_Impl::Delete() {
+// beginService( "StreamLink_Impl::Delete" ) ;
+ bool RetVal = DataFlowEditor()->RemoveLink( DataFlowOutNode()->Name() ,
+ OutputParameterName() ,
+ DataFlowNode()->Name() ,
+ InputParameterName() ) ;
+// endService( "StreamLink_Impl::Delete" );
+ return RetVal ;
+}
+
+SUPERV::StreamPort_ptr StreamLink_Impl::InStreamPort() {
+// beginService( "Link_Impl::InStreamPort" );
+ SUPERV::StreamPort_var iobject = SUPERV::StreamPort::_nil() ;
+ GraphBase::InPort * anInPort = DataFlowNode()->GetChangeInPort( InputParameterName() ) ;
+ if ( anInPort && anInPort->IsDataStream() ) {
+ iobject = SUPERV::StreamPort::_narrow( anInPort->ObjRef() ) ;
+ if ( CORBA::is_nil( iobject ) ) {
+// MESSAGE( "StreamLink_Impl::InStreamPort creates myStreamPort "
+// << DataFlowNode()->Name() << "( " << anInPort->PortName() << " )" ) ;
+ StreamPort_Impl * myStreamPort = new StreamPort_Impl(
+ _Orb , _Poa , _ContId ,
+ instanceName() , interfaceName() ,
+ DataFlowEditor() ,
+ DataFlowNode() ,
+ (GraphBase::Port * ) anInPort ,
+ true ) ;
+ PortableServer::ObjectId * id = myStreamPort->getId() ;
+ CORBA::Object_var obj = _poa->id_to_reference(*id);
+ iobject = SUPERV::StreamPort::_narrow(obj) ;
+ anInPort->ObjRef( SUPERV::StreamPort::_duplicate( iobject ) ) ;
+ }
+ else {
+// MESSAGE( "StreamLink_Impl::InStreamPort Gets ObjRef "
+// << iobject->Node()->Name() << "( " << iobject->Name() << " )" ) ;
+ }
+ }
+// endService( "StreamLink_Impl::InStreamPort" );
+ return SUPERV::StreamPort::_duplicate( iobject ) ;
+}
+
+SUPERV::StreamPort_ptr StreamLink_Impl::OutStreamPort() {
+// beginService( "StreamLink_Impl::OutStreamPort" );
+ SUPERV::StreamPort_var iobject ;
+ GraphBase::OutPort * anOutPort = DataFlowOutNode()->GetChangeOutPort( OutputParameterName() ) ;
+ if ( anOutPort && anOutPort->IsDataStream() ) {
+ iobject = SUPERV::StreamPort::_narrow( anOutPort->ObjRef() ) ;
+ if ( CORBA::is_nil( iobject ) ) {
+// MESSAGE( "StreamLink_Impl::OutStreamPort creates myStreamPort "
+// << DataFlowNode()->Name() << "( " << anOutPort->PortName() << " )" ) ;
+ StreamPort_Impl * myStreamPort = new StreamPort_Impl(
+ _Orb , _Poa , _ContId ,
+ instanceName() , interfaceName() ,
+ DataFlowEditor() ,
+ DataFlowOutNode() ,
+ (GraphBase::Port * ) anOutPort ,
+ false ) ;
+ PortableServer::ObjectId * id = myStreamPort->getId() ;
+ CORBA::Object_var obj = _poa->id_to_reference(*id);
+ iobject = SUPERV::StreamPort::_narrow(obj) ;
+ anOutPort->ObjRef( SUPERV::StreamPort::_duplicate( iobject ) ) ;
+ }
+ else {
+// MESSAGE( "StreamLink_Impl::OutStreamPort Gets ObjRef "
+// << iobject->Node()->Name() << "( " << iobject->Name() << " )" ) ;
+ }
+ }
+// endService( "StreamLink_Impl::OutStreamPort" );
+ return SUPERV::StreamPort::_duplicate( iobject ) ;
+}
+
--- /dev/null
+// SUPERV Supervision : contains the implementation of interfaces of SuperVision described in SUPERV.idl
+//
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+//
+//
+//
+// File : StreamLink_Impl.hxx
+// Author : Jean Rahuel
+// Module : SUPERV
+// $Header:
+
+#ifndef _STREAMLINK_IMPL_HXX_
+#define _STREAMLINK_IMPL_HXX_
+
+#include "StreamPort_Impl.hxx"
+
+#include "Link_Impl.hxx"
+
+class StreamLink_Impl : public POA_SUPERV::StreamLink ,
+ public Link_Impl {
+ private:
+
+ CORBA::ORB_ptr _Orb ;
+ PortableServer::POA_ptr _Poa ;
+ PortableServer::ObjectId * _ContId ;
+
+ public:
+ StreamLink_Impl();
+ StreamLink_Impl( CORBA::ORB_ptr orb ,
+ PortableServer::POA_ptr poa ,
+ PortableServer::ObjectId * contId ,
+ const char *instanceName ,
+ const char *interfaceName ,
+ GraphEditor::DataFlow * DataFlowEditor ,
+ GraphEditor::InNode * DataFlowNode ,
+ const char *InputParameterName ,
+ GraphEditor::InNode * DataFlowOutNode ,
+ const char *OutputParameterName ,
+ const bool Create ) ;
+
+ virtual ~StreamLink_Impl() ;
+ virtual void destroy() ;
+ virtual bool Delete() ;
+
+ SUPERV::StreamPort_ptr OutStreamPort() ;
+ SUPERV::StreamPort_ptr InStreamPort() ;
+
+} ;
+
+#endif
--- /dev/null
+// SUPERV Supervision : contains the implementation of interfaces of SuperVision described in SUPERV.idl
+//
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+//
+//
+//
+// File : StreamPort_Impl.cxx
+// Author : Jean Rahuel
+// Module : SUPERV
+// $Header:
+
+using namespace std;
+
+#include "StreamPort_Impl.hxx"
+
+StreamPort_Impl::StreamPort_Impl( CORBA::ORB_ptr orb ,
+ PortableServer::POA_ptr poa ,
+ PortableServer::ObjectId * contId ,
+ const char *instanceName ,
+ const char *interfaceName ,
+ GraphEditor::DataFlow * DataFlowEditor ,
+ GraphEditor::InNode * DataFlowNode ,
+ GraphBase::Port * DataFlowPort ,
+ bool InputPort ,
+ const CORBA::Any * anAny ) :
+ Port_Impl( orb , poa , contId , instanceName , interfaceName ,
+ DataFlowEditor , DataFlowNode , DataFlowPort , InputPort , anAny ) {
+// MESSAGE("StreamPort_Impl::StreamPort_Impl activate object instanceName("
+// << instanceName << ") interfaceName(" << interfaceName << ") --> "
+// << hex << (void *) this << dec )
+ _Orb = CORBA::ORB::_duplicate(orb);
+ _Poa = poa ;
+ _ContId = contId ;
+ _thisObj = this ;
+ _id = _poa->activate_object(_thisObj);
+}
+
+StreamPort_Impl::StreamPort_Impl( CORBA::ORB_ptr orb ,
+ PortableServer::POA_ptr poa ,
+ PortableServer::ObjectId * contId ,
+ const char *instanceName ,
+ const char *interfaceName ,
+ GraphEditor::DataFlow * DataFlowEditor ,
+ GraphEditor::InNode * DataFlowNode ,
+ GraphBase::Port * DataFlowPort ,
+ bool InputPort ) :
+ Port_Impl( orb , poa , contId , instanceName , interfaceName ,
+ DataFlowEditor , DataFlowNode , DataFlowPort , InputPort ) {
+// MESSAGE("StreamPort_Impl::StreamPorte_Impl activate object instanceName("
+// << instanceName << ") interfaceName(" << interfaceName << ") --> "
+// << hex << (void *) this << dec )
+ _Orb = CORBA::ORB::_duplicate(orb);
+ _Poa = poa ;
+ _ContId = contId ;
+ _thisObj = this ;
+ _id = _poa->activate_object(_thisObj);
+}
+
+StreamPort_Impl::StreamPort_Impl() {
+}
+
+StreamPort_Impl::~StreamPort_Impl() {
+ beginService( "StreamPort_Impl::~StreamPort_Impl" );
+ endService( "StreamPort_Impl::~StreamPort_Impl" );
+}
+
+void StreamPort_Impl::destroy() {
+ beginService( "StreamPort_Impl::destroy" );
+ bool destroyed = false ;
+ if ( DataFlowNode()->IsOneOfInLineNodes() ) {
+ if ( IsInput() ) {
+ GraphBase::InPort * anInPort = (GraphBase::InPort * ) DataFlowPort() ;
+ if ( anInPort->GetOutPort() ) {
+ anInPort->GetOutPort()->RemoveInPort( anInPort ) ;
+ }
+ DataFlowNode()->DelInPort( DataFlowPort()->PortName() ) ;
+ destroyed = true ;
+ }
+ else {
+ DataFlowNode()->DelOutPort( DataFlowPort()->PortName() ) ;
+ destroyed = true ;
+ }
+ if ( destroyed ) {
+ DataFlowEditor()->UnValid() ;
+ }
+ }
+ if ( destroyed ) {
+ _poa->deactivate_object(*_id) ;
+ CORBA::release(_poa) ;
+ delete(_id) ;
+ _thisObj->_remove_ref();
+ }
+ endService( "StreamPort_Impl::destroy" );
+}
+
+
+SUPERV::StreamLink_ptr StreamPort_Impl::StreamLink() {
+ bool begin = true ;
+ SUPERV::StreamLink_var iobject = SUPERV::StreamLink::_nil() ;
+ char * FromNodeName = NULL ;
+ char * FromServiceParameterName = NULL ;
+ bool status = DataFlowEditor()->GetLink( DataFlowNode()->Name() ,
+ DataFlowPort()->PortName() ,
+ & FromNodeName ,
+ & FromServiceParameterName ) ;
+ if ( status ) {
+// cout << "Port_Impl::Link " << FromNodeName << "("
+// << FromServiceParameterName << ") --> " << _DataFlowNode->Name()
+// << "(" << _DataFlowPort->PortName() << ")" << endl ;
+// SUPERV::Port_ptr theOutPort = Port( FromServiceParameterName ) ;
+
+ GraphBase::InPort * anInPort = DataFlowNode()->GetChangeInPort( DataFlowPort()->PortName() ) ;
+ if ( anInPort->GetOutPort() ) {
+ GraphBase::OutPort * anOutPort = anInPort->GetOutPort() ;
+ if ( CORBA::is_nil( anOutPort->InPortObjRef( anInPort ) ) ) {
+ if ( begin ) {
+ beginService( "Port_Impl::Link" ) ;
+ begin = false ;
+ }
+ StreamLink_Impl * myStreamLink = new StreamLink_Impl( _Orb , _Poa , _ContId ,
+ instanceName() , interfaceName() ,
+ DataFlowEditor() ,
+ DataFlowNode() ,
+ DataFlowPort()->PortName() ,
+ (GraphEditor::InNode * ) DataFlowEditor()->Graph()->GetChangeGraphNode( FromNodeName )->GetInNode() ,
+ FromServiceParameterName ,
+ false ) ;
+ PortableServer::ObjectId * id = myStreamLink->getId() ;
+ CORBA::Object_var obj = _poa->id_to_reference(*id);
+ iobject = SUPERV::StreamLink::_narrow(obj) ;
+ anOutPort->AddInPortObjRef( anInPort , SUPERV::StreamLink::_duplicate( iobject ) ) ;
+ }
+ else {
+ iobject = SUPERV::StreamLink::_narrow( anOutPort->InPortObjRef( anInPort ) ) ;
+ }
+ }
+ }
+ if ( !begin ) {
+ MESSAGE( "Link " << iobject->OutPort()->Node()->Name() << "( " << iobject->OutPort()->Name() << " ) --> "
+ << iobject->InPort()->Node()->Name() << "( " << iobject->InPort()->Name() << " ) " ) ;
+ endService( "StreamPort_Impl::StreamLink" ) ;
+ }
+ return SUPERV::StreamLink::_duplicate( iobject ) ;
+}
+
+SALOME_ModuleCatalog::DataStreamDependency StreamPort_Impl::Dependency() {
+// beginService( "StreamPort_Impl::Dependency" );
+ SALOME_ModuleCatalog::DataStreamDependency RetVal = DataFlowPort()->Dependency() ;
+// endService( "StreamPort_Impl::Dependency" );
+ return RetVal ;
+}
+
+bool StreamPort_Impl::SetDependency( const SALOME_ModuleCatalog::DataStreamDependency aDependency ) {
+// beginService( "StreamPort_Impl::SetDependency" );
+ DataFlowPort()->Dependency( aDependency ) ;
+// endService( "StreamPort_Impl::SetDependency" );
+ return true ;
+}
+
+bool StreamPort_Impl::SetParams( const SUPERV::KindOfSchema aKindOfSchema ,
+ const SUPERV::KindOfInterpolation aKindOfInterpolation ,
+ const SUPERV::KindOfExtrapolation aKindOfExtrapolation ) {
+// beginService( "StreamPort_Impl::SetParams" );
+ bool RetVal = false ;
+ if ( IsInput() ) {
+ GraphBase::InDataStreamPort * anInStreamPort = (GraphBase::InDataStreamPort * ) DataFlowPort() ;
+ RetVal = anInStreamPort->SetParams( aKindOfSchema , aKindOfInterpolation , aKindOfExtrapolation ) ;
+ MESSAGE( "OutStreamPort_Impl::SetParams( " << aKindOfSchema << " , " << aKindOfInterpolation
+ << " , " << aKindOfExtrapolation << " ) sts " << RetVal ) ;
+ }
+ else {
+ MESSAGE( "OutStreamPort_Impl::SetParams( " << aKindOfSchema << " , " << aKindOfInterpolation
+ << " , " << aKindOfExtrapolation << " ) ERROR : OutPort" ) ;
+ }
+// endService( "StreamPort_Impl::SetParams" );
+ return RetVal ;
+}
+
+bool StreamPort_Impl::Params( SUPERV::KindOfSchema & aKindOfSchema ,
+ SUPERV::KindOfInterpolation & aKindOfInterpolation ,
+ SUPERV::KindOfExtrapolation & aKindOfExtrapolation ) {
+// beginService( "StreamPort_Impl::Params" );
+ bool RetVal = false ;
+ if ( IsInput() ) {
+ GraphBase::InDataStreamPort * anInStreamPort = (GraphBase::InDataStreamPort * ) DataFlowPort() ;
+ anInStreamPort->Params( aKindOfSchema , aKindOfInterpolation , aKindOfExtrapolation ) ;
+ MESSAGE( "InStreamPort_Impl::Params( " << aKindOfSchema << " , " << aKindOfInterpolation << " , " << aKindOfExtrapolation << " )" ) ;
+ RetVal = true ;
+ }
+ else {
+ aKindOfSchema = (SUPERV::KindOfSchema ) -1 ;
+ aKindOfInterpolation = (SUPERV::KindOfInterpolation ) -1 ;
+ aKindOfExtrapolation = (SUPERV::KindOfExtrapolation ) -1 ;
+ MESSAGE( "OutStreamPort_Impl::Params( " << aKindOfSchema << " , " << aKindOfInterpolation
+ << " , " << aKindOfExtrapolation << " ) ERROR: OutPort" ) ;
+ }
+// endService( "StreamPort_Impl::Params" );
+ return RetVal ;
+}
+
+bool StreamPort_Impl::SetNumberOfValues( const long aNumberOfValues ) {
+// beginService( "StreamPort_Impl::SetNumberOfValues" );
+ bool RetVal = false ;
+ if ( !IsInput() ) {
+ GraphBase::OutDataStreamPort * anOutStreamPort = (GraphBase::OutDataStreamPort * ) DataFlowPort() ;
+ anOutStreamPort->NumberOfValues( aNumberOfValues ) ;
+ RetVal = true ;
+ }
+ else {
+ MESSAGE( "OutStreamPort_Impl::SetNumberOfValues( " << aNumberOfValues << " ) ERROR : InPort" ) ;
+ }
+// endService( "StreamPort_Impl::SetNumberOfValues" );
+ return RetVal ;
+}
+
+long StreamPort_Impl::NumberOfValues() {
+// beginService( "StreamPort_Impl::NumberOfValues" );
+ long RetVal = -1 ;
+ if ( !IsInput() ) {
+ GraphBase::OutDataStreamPort * anOutStreamPort = (GraphBase::OutDataStreamPort * ) DataFlowPort() ;
+ RetVal = anOutStreamPort->NumberOfValues() ;
+ MESSAGE( "OutStreamPort_Impl::NumberOfValues() " << RetVal ) ;
+ }
+ else {
+ MESSAGE( "OutStreamPort_Impl::NumberOfValues() ERROR : InPort" ) ;
+ }
+// endService( "StreamPort_Impl::NumberOfValues" );
+ return RetVal ;
+}
+
--- /dev/null
+// SUPERV Supervision : contains the implementation of interfaces of SuperVision described in SUPERV.idl
+//
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+//
+//
+//
+// File : StreamPort_Impl.hxx
+// Author : Jean Rahuel
+// Module : SUPERV
+// $Header:
+
+#ifndef _STREAMPORT_IMPL_HXX_
+#define _STREAMPORT_IMPL_HXX_
+
+#include "Port_Impl.hxx"
+
+#include "StreamLink_Impl.hxx"
+
+class StreamPort_Impl : public Port_Impl ,
+ public POA_SUPERV::StreamPort {
+ private:
+
+ CORBA::ORB_ptr _Orb ;
+ PortableServer::POA_ptr _Poa ;
+ PortableServer::ObjectId * _ContId ;
+
+ public:
+ StreamPort_Impl();
+ StreamPort_Impl( CORBA::ORB_ptr orb ,
+ PortableServer::POA_ptr poa ,
+ PortableServer::ObjectId * contId ,
+ const char *instanceName ,
+ const char *interfaceName ,
+ GraphEditor::DataFlow * DataFlowEditor ,
+ GraphEditor::InNode * DataStreamNode ,
+ GraphBase::Port * DataStreamPort ,
+ bool InputPort ,
+ const CORBA::Any * anAny ) ;
+ StreamPort_Impl( CORBA::ORB_ptr orb ,
+ PortableServer::POA_ptr poa ,
+ PortableServer::ObjectId * contId ,
+ const char *instanceName ,
+ const char *interfaceName ,
+ GraphEditor::DataFlow * DataFlowEditor ,
+ GraphEditor::InNode * DataFlowNode ,
+ GraphBase::Port * DataStreamPort ,
+ bool InputPort ) ;
+ virtual ~StreamPort_Impl() ;
+ virtual void destroy() ;
+
+ virtual SUPERV::StreamLink_ptr StreamLink() ;
+
+ virtual SALOME_ModuleCatalog::DataStreamDependency Dependency() ;
+ virtual bool SetDependency( const SALOME_ModuleCatalog::DataStreamDependency aDependency ) ;
+
+ virtual bool SetParams( const SUPERV::KindOfSchema aKindOfSchema ,
+ const SUPERV::KindOfInterpolation aKindOfInterpolation ,
+ const SUPERV::KindOfExtrapolation aKindOfExtrapolation ) ;
+ virtual bool Params( SUPERV::KindOfSchema & aKindOfSchema ,
+ SUPERV::KindOfInterpolation & aKindOfInterpolation ,
+ SUPERV::KindOfExtrapolation & aKindOfExtrapolation ) ;
+
+ virtual bool SetNumberOfValues( const long aNumberOfValues ) ;
+ virtual long NumberOfValues() ;
+
+} ;
+
+#endif