2 //=============================================================================
3 // File : Link_Impl.cxx
5 // Author : Jean Rahuel
8 //=============================================================================
15 #include "utilities.h"
17 #include "Link_Impl.hxx"
19 Link_Impl::Link_Impl( CORBA::ORB_ptr orb ,
20 PortableServer::POA_ptr poa ,
21 PortableServer::ObjectId * contId ,
22 const char *instanceName ,
23 const char *interfaceName ,
24 GraphEditor::DataFlow * DataFlowEditor ,
25 GraphEditor::InNode * DataFlowNode ,
26 const char *InputParameterName ,
27 GraphEditor::InNode * DataFlowOutNode ,
28 const char *OutputParameterName ,
30 // const SUPERV::Value_ptr aValue ) :
31 Engines_Component_i(orb, poa, contId, instanceName, interfaceName, false, false) {
32 // MESSAGE("Link_Impl::Link_Impl activate object instanceName("
33 // << instanceName << ") interfaceName(" << interfaceName << ") --> "
34 // << hex << (void *) this << dec )
36 beginService( "Link_Impl::Link_Impl" );
37 _Orb = CORBA::ORB::_duplicate(orb);
40 _DataFlowEditor = DataFlowEditor ;
41 _DataFlowNode = DataFlowNode ;
42 _DataFlowNodeName = DataFlowNode->Name() ;
43 _InputParameterName = new char[ strlen( InputParameterName ) + 1 ] ;
44 strcpy( _InputParameterName , InputParameterName ) ;
45 _DataFlowOutNode = DataFlowOutNode ;
46 _DataFlowOutNodeName = DataFlowOutNode->Name() ;
47 _OutputParameterName = new char[ strlen( OutputParameterName ) + 1 ] ;
48 strcpy( _OutputParameterName , OutputParameterName ) ;
50 linksts = _DataFlowEditor->AddLink( _DataFlowOutNode->Name() ,
51 _OutputParameterName ,
52 _DataFlowNode->Name() ,
53 _InputParameterName ) ;
56 char * DataFlowOutNodeName = NULL ;
57 char * OutParamName = NULL ;
58 linksts = _DataFlowEditor->GetLink( _DataFlowNode->Name() ,
60 &DataFlowOutNodeName ,
64 _id = _poa->activate_object(_thisObj);
65 endService( "Link_Impl::Link_Impl" );
68 Link_Impl::Link_Impl() {
71 Link_Impl::~Link_Impl() {
72 beginService( "Link_Impl::~Link_Impl" );
73 endService( "Link_Impl::~Link_Impl" );
76 void Link_Impl::destroy() {
77 beginService( "Link_Impl::destroy" );
79 _poa->deactivate_object(*_id) ;
80 CORBA::release(_poa) ;
82 _thisObj->_remove_ref();
83 endService( "Link_Impl::destroy" );
86 bool Link_Impl::Delete() {
87 // beginService( "Link_Impl::Delete" ) ;
88 bool RetVal = _DataFlowEditor->RemoveLink( _DataFlowOutNode->Name() ,
89 _OutputParameterName ,
90 _DataFlowNode->Name() ,
91 _InputParameterName ) ;
92 // endService( "Link_Impl::Delete" );
96 SUPERV::Port_ptr Link_Impl::InPort() {
97 // beginService( "Link_Impl::InPort" );
98 GraphBase::InPort * anInPort = _DataFlowNode->GetChangeInPort( _InputParameterName ) ;
99 Port_Impl * myPort = new Port_Impl( _Orb , _Poa , _ContId ,
100 instanceName() , interfaceName() ,
103 // _InputParameterName ) ;
104 (GraphBase::Port * ) anInPort ,
106 PortableServer::ObjectId * id = myPort->getId() ;
107 CORBA::Object_var obj = _poa->id_to_reference(*id);
108 SUPERV::Port_var iobject ;
109 iobject = SUPERV::Port::_narrow(obj) ;
110 // endService( "Link_Impl::InPort" );
111 return SUPERV::Port::_duplicate( iobject ) ;
114 SUPERV::Port_ptr Link_Impl::OutPort() {
115 // beginService( "Link_Impl::OutPort" );
116 GraphBase::OutPort * anOutPort = _DataFlowOutNode->GetChangeOutPort( _OutputParameterName ) ;
117 Port_Impl * myPort = new Port_Impl( _Orb , _Poa , _ContId ,
118 instanceName() , interfaceName() ,
121 // _OutputParameterName ) ;
122 (GraphBase::Port * ) anOutPort ,
124 PortableServer::ObjectId * id = myPort->getId() ;
125 CORBA::Object_var obj = _poa->id_to_reference(*id);
126 SUPERV::Port_var iobject ;
127 iobject = SUPERV::Port::_narrow(obj) ;
128 // endService( "Link_Impl::OutPort" );
129 return SUPERV::Port::_duplicate( iobject ) ;
132 GraphBase::SLink * Link_Impl::Info() {
133 // beginService( "Link_Impl::Info" );
135 char* FromServiceParameterName ;
136 GraphBase::SLink * RetVal = _DataFlowEditor->GetLink( _DataFlowNode->ComputingNode() ,
137 _InputParameterName ) ;
138 // endService( "Link_Impl::Info" );
142 long Link_Impl::CoordsSize() {
143 // beginService( "Link_Impl::CoordsSize" ) ;
144 long RetVal = _DataFlowEditor->GetLinkCoordSize( _DataFlowOutNode->Name() ,
145 _OutputParameterName ,
146 _DataFlowNode->Name() ,
147 _InputParameterName ) ;
148 // endService( "Link_Impl::CoordsSize" );
151 bool Link_Impl::AddCoord( const long index ,
154 // beginService( "Link_Impl::AddCoord" ) ;
155 bool RetVal = _DataFlowEditor->AddLinkCoord( _DataFlowOutNode->Name() ,
156 _OutputParameterName ,
157 _DataFlowNode->Name() ,
160 // endService( "Link_Impl::AddCoord" );
163 bool Link_Impl::ChangeCoord( const long index ,
166 // beginService( "Link_Impl::ChangeCoord" ) ;
167 bool RetVal = _DataFlowEditor->ChangeLinkCoord( _DataFlowOutNode->Name() ,
168 _OutputParameterName ,
169 _DataFlowNode->Name() ,
172 // endService( "Link_Impl::ChangeCoord" );
175 bool Link_Impl::RemoveCoord( const long index ) {
176 // beginService( "Link_Impl::RemoveCoord" ) ;
177 bool RetVal = _DataFlowEditor->RemoveLinkCoord( _DataFlowOutNode->Name() ,
178 _OutputParameterName ,
179 _DataFlowNode->Name() ,
182 // endService( "Link_Impl::RemoveCoord" );
185 bool Link_Impl::Coords( const long index , long & X , long & Y ) {
186 // beginService( "Link_Impl::Coords" ) ;
187 bool RetVal = _DataFlowEditor->GetLinkCoord( _DataFlowOutNode->Name() ,
188 _OutputParameterName ,
189 _DataFlowNode->Name() ,
192 // endService( "Link_Impl::Coords" );