using namespace std;
#include <stdio.h>
#include <fstream>
-#include <strstream>
+//#include <strstream>
+//#include <sstream>
#include <string>
-#include "utilities.h"
+//#include "utilities.h"
#include "Value_Impl.hxx"
+#include "DataFlowExecutor_DataFlow.hxx"
+
Value_Impl::Value_Impl( CORBA::ORB_ptr orb ,
PortableServer::POA_ptr poa ,
PortableServer::ObjectId * contId ,
if ( ParameterName != NULL ) {
_ParameterName = new char[ strlen( ParameterName ) + 1 ] ;
strcpy( _ParameterName , ParameterName ) ;
+ if ( DataFlowNode ) {
+ _NodeName = new char[ strlen( DataFlowNode->Name() ) + 1 ] ;
+ strcpy( _NodeName , DataFlowNode->Name() ) ;
+ }
+ else {
+ _NodeName = NULL ;
+ }
}
else {
_ParameterName = NULL ;
+ _NodeName = NULL ;
}
_InputValue = false ;
_Any = new CORBA::Any( *anAny ) ;
if ( ParameterName != NULL ) {
_ParameterName = new char[ strlen( ParameterName ) + 1 ] ;
strcpy( _ParameterName , ParameterName ) ;
+ if ( DataFlowNode ) {
+ _NodeName = new char[ strlen( DataFlowNode->Name() ) + 1 ] ;
+ strcpy( _NodeName , DataFlowNode->Name() ) ;
+ }
+ else {
+ _NodeName = NULL ;
+ }
}
else {
_ParameterName = NULL ;
+ _NodeName = NULL ;
}
_InputValue = false ;
_Any = new CORBA::Any() ;
}
CORBA::Any * Value_Impl::ToAny() {
+ beginService( "Value_Impl::ToAny" );
CORBA::Any * anAny ;
if ( _DataFlowEditor ) {
char * name ;
name = _DataFlowNode->Name() ;
}
else {
- name = _DataFlowEditor->Name() ;
+ name = _DataFlowEditor->Graph()->Name() ;
}
+ MESSAGE( "ToAny " << name<< "( " << _ParameterName << " )" ) ;
if ( _InputPort ) {
if ( _DataFlowNode ) {
_InputValue = _DataFlowNode->HasInput( _ParameterName ) ;
else {
_InputValue = _DataFlowEditor->HasInput( _ParameterName ) ;
}
- if ( _InputValue && _DataFlowEditor->IsEditing() ) {
- anAny = new CORBA::Any( * _DataFlowEditor->GetInData( name ,
+ GraphExecutor::DataFlow * _DataFlowExecutor = _DataFlowEditor->Executor() ;
+ if ( _DataFlowExecutor ) {
+//JR 30.03.2005 anAny = new CORBA::Any( * _DataFlowExecutor->GetInData( name ,
+ anAny = new CORBA::Any( _DataFlowExecutor->GetInData( name ,
_ParameterName ) ) ;
}
+ else if ( _InputValue ) {
+//JR 30.03.2005 anAny = new CORBA::Any( * _DataFlowEditor->GetInData( name ,
+ anAny = new CORBA::Any( _DataFlowEditor->GetInData( name ,
+ _ParameterName ) ) ;
+ }
else {
- GraphExecutor::DataFlow * _DataFlowExecutor = _DataFlowEditor->Executor() ;
- if ( _DataFlowExecutor ) {
- anAny = new CORBA::Any( * _DataFlowExecutor->GetInData( name ,
- _ParameterName ) ) ;
- }
- else {
- anAny = new CORBA::Any( *_Any ) ;
- }
+ anAny = new CORBA::Any( *_Any ) ;
}
}
else {
- if ( _InputValue && _DataFlowEditor->IsEditing() ) {
- anAny = new CORBA::Any( * _DataFlowEditor->GetOutData( name ,
+ GraphExecutor::DataFlow * _DataFlowExecutor = _DataFlowEditor->Executor() ;
+ if ( _DataFlowExecutor ) {
+//JR 30.03.2005 anAny = new CORBA::Any( * _DataFlowExecutor->GetOutData( name ,
+ anAny = new CORBA::Any( _DataFlowExecutor->GetOutData( name ,
_ParameterName ) ) ;
}
else {
- GraphExecutor::DataFlow * _DataFlowExecutor = _DataFlowEditor->Executor() ;
- if ( _DataFlowExecutor ) {
- anAny = new CORBA::Any( * _DataFlowExecutor->GetOutData( name ,
- _ParameterName ) ) ;
- }
- else {
- anAny = new CORBA::Any( *_Any ) ;
- }
+ anAny = new CORBA::Any( *_Any ) ;
}
}
}
else {
anAny = new CORBA::Any( *_Any ) ;
}
+ endService( "Value_Impl::ToAny" );
return anAny ;
}
char * Value_Impl::ToString() {
// beginService( "Value_Impl::ToString" );
- CORBA::Any anAny = *ToAny() ;
-// cout << "Value_Impl::ToString " << _DataFlowNode->Name() << " "
-// << _ParameterName << " " ;
+//JR 22.03.2005 Memory Leak CORBA::Any anAny = *ToAny() ;
+ CORBA::Any anAny ;
if ( _DataFlowEditor ) {
char * name ;
if ( _DataFlowNode ) {
name = _DataFlowNode->Name() ;
}
else {
- name = _DataFlowEditor->Name() ;
+ name = _DataFlowEditor->Graph()->Name() ;
}
+// MESSAGE( "ToString " << name<< "( " << _ParameterName << " )" ) ;
if ( _InputPort ) {
if ( _DataFlowNode ) {
_InputValue = _DataFlowNode->HasInput( _ParameterName ) ;
else {
_InputValue = _DataFlowEditor->HasInput( _ParameterName ) ;
}
- if ( _InputValue && _DataFlowEditor->IsEditing() ) {
- anAny = * _DataFlowEditor->GetInData( name ,
- _ParameterName ) ;
+ GraphExecutor::DataFlow * _DataFlowExecutor = _DataFlowEditor->Executor() ;
+ if ( _DataFlowExecutor ) {
+// cout << "-->_DataFlowExecutor->GetInData " << name << " " << _ParameterName << endl ;
+//JR 30.03.2005 const CORBA::Any * AnyPtr = _DataFlowExecutor->GetInData( name ,
+ const CORBA::Any AnyRef = _DataFlowExecutor->GetInData( name ,
+ _ParameterName ) ;
+//JR 30.03.2005 cout << "<--_DataFlowExecutor->GetInData " << AnyPtr << endl ;
+//JR 30.03.2005 anAny = * AnyPtr ;
+ anAny = AnyRef ;
+ }
+ else if ( _InputValue ) {
+// cout << "_DataFlowEditor->GetInData _DataFlowNode " << _DataFlowNode
+// << " _InputValue " << _InputValue << endl ;
+//JR 30.03.2005 anAny = * _DataFlowEditor->GetInData( name ,
+ anAny = _DataFlowEditor->GetInData( name ,
+ _ParameterName ) ;
}
else {
- GraphExecutor::DataFlow * _DataFlowExecutor = _DataFlowEditor->Executor() ;
- if ( _DataFlowExecutor ) {
- anAny = * _DataFlowExecutor->GetInData( name ,
- _ParameterName ) ;
- }
+ anAny = *_Any ;
}
}
else {
- if ( _InputValue && _DataFlowEditor->IsEditing() ) {
- anAny = * _DataFlowEditor->GetOutData( name ,
- _ParameterName ) ;
+ GraphExecutor::DataFlow * _DataFlowExecutor = _DataFlowEditor->Executor() ;
+ if ( _DataFlowExecutor ) {
+// cout << "-->_DataFlowExecutor->GetOutData " << name << " " << _ParameterName << endl ;
+//JR 30.03.2005 const CORBA::Any * AnyPtr = _DataFlowExecutor->GetOutData( name ,
+ const CORBA::Any AnyRef = _DataFlowExecutor->GetOutData( name ,
+ _ParameterName ) ;
+//JR 30.03.2005 cout << "<--_DataFlowExecutor->GetOutData " << AnyPtr << endl ;
+//JR 30.03.2005 anAny = * AnyPtr ;
+ anAny = AnyRef ;
}
else {
- GraphExecutor::DataFlow * _DataFlowExecutor = _DataFlowEditor->Executor() ;
- if ( _DataFlowExecutor ) {
- anAny = * _DataFlowExecutor->GetOutData( name ,
- _ParameterName ) ;
- }
+ anAny = *_Any ;
}
}
}
- char* retstr ;
+ ostringstream astr ;
+ const char * retstr ;
+ int startstr = 0 ;
switch (anAny.type()->kind()) {
case CORBA::tk_string: {
anAny >>= retstr;
-// MESSAGE( "ToString( string ) " << retstr );
- break ;
- }
- case CORBA::tk_double: {
- double d;
- anAny >>= d;
- retstr = new char[13];
- snprintf(retstr, 13, "%lf", d);
-// MESSAGE( "ToString( double ) " << retstr );
+// MESSAGE( "ToString( string ) '" << retstr << "'" );
break ;
}
case CORBA::tk_long: {
long l;
anAny >>= l;
- retstr = new char[13];
- snprintf(retstr, 13, "%ld", l);
-// MESSAGE( "ToString( long ) " << retstr );
+ astr << l << ends ;
+ retstr = astr.str().c_str() ;
+// MESSAGE( "ToString( long ) '" << l << " " << retstr << "'" );
+ break ;
+ }
+ case CORBA::tk_double: {
+ double d;
+ anAny >>= d;
+ astr << setw(25) << setprecision(18) << d << ends ;
+ retstr = astr.str().c_str() ;
+ int i = 0 ;
+ while ( i < (int ) strlen( retstr ) && retstr[ i++ ] == ' ' ) {
+ startstr = i ;
+ }
+// MESSAGE( "ToString( double ) '" << d << "' '" << retstr << "' '" << &retstr[ startstr ] << "'");
break ;
}
case CORBA::tk_objref: {
CORBA::Object_ptr obj ;
try {
anAny >>= obj ;
- retstr = _Orb->object_to_string(obj );
-// MESSAGE( "ToString( object ) " << retstr );
+ retstr = _Orb->object_to_string( obj );
+// MESSAGE( "ToString( object ) '" << retstr << "'" );
}
catch ( ... ) {
- retstr = "Unknown CORBA::Any Type" ;
+ retstr = "object_to_string catched " ;
}
break ;
}
}
}
// endService( "Value_Impl::ToString" );
- return CORBA::string_dup( retstr ) ;
+ return CORBA::string_dup( &retstr[ startstr ] ) ;
}
bool Value_Impl::IsIOR() {
name = _DataFlowNode->Name() ;
}
else {
- name = _DataFlowEditor->Name() ;
+ name = _DataFlowEditor->Graph()->Name() ;
}
if ( _InputPort ) {
if ( _DataFlowNode ) {
_InputValue = _DataFlowEditor->HasInput( _ParameterName ) ;
}
if ( _InputValue && _DataFlowEditor->IsEditing() ) {
- anAny = * _DataFlowEditor->GetInData( name ,
- _ParameterName ) ;
+//JR 30.03.2005 anAny = * _DataFlowEditor->GetInData( name ,
+ anAny = _DataFlowEditor->GetInData( name ,
+ _ParameterName ) ;
}
else {
GraphExecutor::DataFlow * _DataFlowExecutor = _DataFlowEditor->Executor() ;
if ( _DataFlowExecutor ) {
- anAny = * _DataFlowExecutor->GetInData( name ,
- _ParameterName ) ;
+//JR 30.03.2005 anAny = * _DataFlowExecutor->GetInData( name ,
+ anAny = _DataFlowExecutor->GetInData( name ,
+ _ParameterName ) ;
}
}
}
else {
if ( _InputValue && _DataFlowEditor->IsEditing() ) {
- anAny = * _DataFlowEditor->GetOutData( name ,
- _ParameterName ) ;
+//JR 30.03.2005 anAny = * _DataFlowEditor->GetOutData( name ,
+ anAny = _DataFlowEditor->GetOutData( name ,
+ _ParameterName ) ;
}
else {
GraphExecutor::DataFlow * _DataFlowExecutor = _DataFlowEditor->Executor() ;
if ( _DataFlowExecutor ) {
- anAny = * _DataFlowExecutor->GetOutData( name ,
- _ParameterName ) ;
+//JR 30.03.2005 anAny = * _DataFlowExecutor->GetOutData( name ,
+ anAny = _DataFlowExecutor->GetOutData( name ,
+ _ParameterName ) ;
}
}
}
char* Value_Impl::ComponentDataType() {
GraphExecutor::DataFlow* _DataFlowExecutor = _DataFlowEditor->Executor();
- const GraphBase::ComputingNode* node = _DataFlowExecutor->GetGraphNode(_DataFlowNode->Name());
+ const GraphBase::ComputingNode* node = _DataFlowExecutor->Graph()->GetGraphNode(_DataFlowNode->Name());
if ( node->IsFactoryNode() ) {
Engines::Component_var compo = ((GraphBase::FactoryNode * ) node )->Component();
if ( CORBA::is_nil( compo ) ) {