1 // SUPERV Supervision : contains the implementation of interfaces of SuperVision described in SUPERV.idl
3 // Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
24 // File : Link_Impl.cxx
25 // Author : Jean Rahuel
35 #include "utilities.h"
37 #include "Link_Impl.hxx"
39 Link_Impl::Link_Impl( CORBA::ORB_ptr orb ,
40 PortableServer::POA_ptr poa ,
41 PortableServer::ObjectId * contId ,
42 const char *instanceName ,
43 const char *interfaceName ,
44 GraphEditor::DataFlow * DataFlowEditor ,
45 GraphEditor::InNode * DataFlowNode ,
46 const char *InputParameterName ,
47 GraphEditor::InNode * DataFlowOutNode ,
48 const char *OutputParameterName ,
50 // const SUPERV::Value_ptr aValue ) :
51 Engines_Component_i(orb, poa, contId, instanceName, interfaceName, false, false) {
52 // MESSAGE("Link_Impl::Link_Impl activate object instanceName("
53 // << instanceName << ") interfaceName(" << interfaceName << ") --> "
54 // << hex << (void *) this << dec )
56 beginService( "Link_Impl::Link_Impl" );
57 _Orb = CORBA::ORB::_duplicate(orb);
60 _DataFlowEditor = DataFlowEditor ;
61 _DataFlowNode = DataFlowNode ;
62 _DataFlowNodeName = DataFlowNode->Name() ;
63 _InputParameterName = new char[ strlen( InputParameterName ) + 1 ] ;
64 strcpy( _InputParameterName , InputParameterName ) ;
65 _DataFlowOutNode = DataFlowOutNode ;
66 _DataFlowOutNodeName = DataFlowOutNode->Name() ;
67 _OutputParameterName = new char[ strlen( OutputParameterName ) + 1 ] ;
68 strcpy( _OutputParameterName , OutputParameterName ) ;
70 linksts = _DataFlowEditor->AddLink( _DataFlowOutNode->Name() ,
71 _OutputParameterName ,
72 _DataFlowNode->Name() ,
73 _InputParameterName ) ;
76 char * DataFlowOutNodeName = NULL ;
77 char * OutParamName = NULL ;
78 linksts = _DataFlowEditor->GetLink( _DataFlowNode->Name() ,
80 &DataFlowOutNodeName ,
84 _id = _poa->activate_object(_thisObj);
85 endService( "Link_Impl::Link_Impl" );
88 Link_Impl::Link_Impl() {
91 Link_Impl::~Link_Impl() {
92 beginService( "Link_Impl::~Link_Impl" );
93 endService( "Link_Impl::~Link_Impl" );
96 void Link_Impl::destroy() {
97 beginService( "Link_Impl::destroy" );
99 _poa->deactivate_object(*_id) ;
100 CORBA::release(_poa) ;
102 _thisObj->_remove_ref();
103 endService( "Link_Impl::destroy" );
106 bool Link_Impl::Delete() {
107 // beginService( "Link_Impl::Delete" ) ;
108 bool RetVal = _DataFlowEditor->RemoveLink( _DataFlowOutNode->Name() ,
109 _OutputParameterName ,
110 _DataFlowNode->Name() ,
111 _InputParameterName ) ;
112 // endService( "Link_Impl::Delete" );
116 SUPERV::Port_ptr Link_Impl::InPort() {
117 // beginService( "Link_Impl::InPort" );
118 GraphBase::InPort * anInPort = _DataFlowNode->GetChangeInPort( _InputParameterName ) ;
119 Port_Impl * myPort = new Port_Impl( _Orb , _Poa , _ContId ,
120 instanceName() , interfaceName() ,
123 // _InputParameterName ) ;
124 (GraphBase::Port * ) anInPort ,
126 PortableServer::ObjectId * id = myPort->getId() ;
127 CORBA::Object_var obj = _poa->id_to_reference(*id);
128 SUPERV::Port_var iobject ;
129 iobject = SUPERV::Port::_narrow(obj) ;
130 // endService( "Link_Impl::InPort" );
131 return SUPERV::Port::_duplicate( iobject ) ;
134 SUPERV::Port_ptr Link_Impl::OutPort() {
135 // beginService( "Link_Impl::OutPort" );
136 GraphBase::OutPort * anOutPort = _DataFlowOutNode->GetChangeOutPort( _OutputParameterName ) ;
137 Port_Impl * myPort = new Port_Impl( _Orb , _Poa , _ContId ,
138 instanceName() , interfaceName() ,
141 // _OutputParameterName ) ;
142 (GraphBase::Port * ) anOutPort ,
144 PortableServer::ObjectId * id = myPort->getId() ;
145 CORBA::Object_var obj = _poa->id_to_reference(*id);
146 SUPERV::Port_var iobject ;
147 iobject = SUPERV::Port::_narrow(obj) ;
148 // endService( "Link_Impl::OutPort" );
149 return SUPERV::Port::_duplicate( iobject ) ;
152 GraphBase::SLink * Link_Impl::Info() {
153 // beginService( "Link_Impl::Info" );
155 char* FromServiceParameterName ;
156 GraphBase::SLink * RetVal = _DataFlowEditor->GetLink( _DataFlowNode->ComputingNode() ,
157 _InputParameterName ) ;
158 // endService( "Link_Impl::Info" );
162 long Link_Impl::CoordsSize() {
163 // beginService( "Link_Impl::CoordsSize" ) ;
164 long RetVal = _DataFlowEditor->GetLinkCoordSize( _DataFlowOutNode->Name() ,
165 _OutputParameterName ,
166 _DataFlowNode->Name() ,
167 _InputParameterName ) ;
168 // endService( "Link_Impl::CoordsSize" );
171 bool Link_Impl::AddCoord( const long index ,
174 // beginService( "Link_Impl::AddCoord" ) ;
175 bool RetVal = _DataFlowEditor->AddLinkCoord( _DataFlowOutNode->Name() ,
176 _OutputParameterName ,
177 _DataFlowNode->Name() ,
180 // endService( "Link_Impl::AddCoord" );
183 bool Link_Impl::ChangeCoord( const long index ,
186 // beginService( "Link_Impl::ChangeCoord" ) ;
187 bool RetVal = _DataFlowEditor->ChangeLinkCoord( _DataFlowOutNode->Name() ,
188 _OutputParameterName ,
189 _DataFlowNode->Name() ,
192 // endService( "Link_Impl::ChangeCoord" );
195 bool Link_Impl::RemoveCoord( const long index ) {
196 // beginService( "Link_Impl::RemoveCoord" ) ;
197 bool RetVal = _DataFlowEditor->RemoveLinkCoord( _DataFlowOutNode->Name() ,
198 _OutputParameterName ,
199 _DataFlowNode->Name() ,
202 // endService( "Link_Impl::RemoveCoord" );
205 bool Link_Impl::Coords( const long index , long & X , long & Y ) {
206 // beginService( "Link_Impl::Coords" ) ;
207 bool RetVal = _DataFlowEditor->GetLinkCoord( _DataFlowOutNode->Name() ,
208 _OutputParameterName ,
209 _DataFlowNode->Name() ,
212 // endService( "Link_Impl::Coords" );