CORBA::Any InitialValue ;
cdebug << "InitialValues " << NodeName() << " " << PortName() << " " << PortType()
<< " : " ;
- if ( !strcmp( Type , "string" ) ) {
+ if ( !strcmp( Type , "" ) ) {
+ cdebug << "void" << endl ;
+ InitialValue <<= (void *) NULL ;
+ }
+ else if ( !strcmp( Type , "string" ) ) {
cdebug << "string" << endl ;
InitialValue <<= (char *) NULL ;
}
- else if ( !strcmp( Type , "double" ) ) {
- cdebug << "double" << endl ;
- InitialValue <<= 0. ;
+ else if ( !strcmp( Type , "boolean" ) ) {
+ cdebug << "boolean" << endl ;
+ InitialValue <<= (long ) 0 ;
+ }
+ else if ( !strcmp( Type , "char" ) ) {
+ cdebug << "char" << endl ;
+ InitialValue <<= (long ) 0 ;
+ }
+ else if ( !strcmp( Type , "short" ) ) {
+ cdebug << "short" << endl ;
+ InitialValue <<= (long ) 0 ;
+ }
+ else if ( !strcmp( Type , "int" ) ) {
+ cdebug << "long" << endl ;
+ InitialValue <<= (long ) 0 ;
}
else if ( !strcmp( Type , "long" ) ) {
cdebug << "long" << endl ;
InitialValue <<= (long ) 0 ;
}
- else if ( !strcmp( Type , "objref" ) ) {
+ else if ( !strcmp( Type , "float" ) ) {
+ cdebug << "float" << endl ;
+ InitialValue <<= (double ) 0. ;
+ }
+ else if ( !strcmp( Type , "double" ) ) {
+ cdebug << "double" << endl ;
+ InitialValue <<= (double ) 0. ;
+ }
+ else { // Default
cdebug << "objref" << endl ;
// InitialValue.replace(CORBA::_tc_Object, NULL);
InitialValue <<= CORBA::Object::_nil() ;
}
- else {
- cdebug << "InitialValues ERROR (other) " << Type << endl ;
- InitialValue <<= (long ) 0 ;
- }
+// else {
+// cdebug << "InitialValues ERROR (other) " << Type << endl ;
+// InitialValue <<= (long ) 0 ;
+// }
_InitialValue = new CORBA::Any( InitialValue ) ;
_Value = &_InitialValue ;
}
// << endl ;
delete _theValue ;
- _theValue = aDataValue ;
- *_Value = aDataValue ;
-// Done( true ) ;
-#if 0
- cdebug << "NewValue " << NodeName() << " " << PortName() << " " << PortType()
- << " : " << _Value << " *_Value " << *_Value << " " ;
- switch (_theValue->type()->kind()) {
- case CORBA::tk_string: {
+ string _Type = CORBA::string_dup( GetServicesParameter().Parametertype ) ;
+ const char * Type = _Type.c_str() ;
+ _Value = &_theValue ;
+// cdebug << "NewValue " << NodeName() << " " << PortName() << " " << PortType()
+// << " : " << aDataValue << " kind " << aDataValue->type()->kind() << " " ;
+ switch (aDataValue->type()->kind()) { // Input Value
+ case CORBA::tk_string: { // Input string Value
char * t;
- *_theValue >>= t;
- cdebug << "Value( " << t << ") (string)";
+ *aDataValue >>= t;
+ cdebug << t << " (string)" ;
+ if ( !strcmp( Type , "string" ) ) { // SuperVision Value
+ _theValue = aDataValue ;
+ *_theValue >>= t;
+// cdebug << " == Value( " << t << ") (string)";
+ }
+ else {
+ CORBA::Any * theValue = new CORBA::Any() ;
+ if ( !strcmp( Type , "boolean" ) || !strcmp( Type , "char" ) ||
+ !strcmp( Type , "short" ) || !strcmp( Type , "int" ) || !strcmp( Type , "long" ) ) {
+ long l ;
+ sscanf( t , "%ld" , &l ) ;
+ *theValue <<= l ;
+ *theValue >>= l;
+// cdebug << " --> Value( " << l << ") (long) kind " << theValue->type()->kind() ;
+ }
+ else if ( !strcmp( Type , "float" ) || !strcmp( Type , "double" ) ) {
+ double d ;
+ sscanf( t , "%lf" , &d ) ;
+ *theValue <<= d ;
+ *theValue >>= d;
+// cdebug << " --> Value( " << d << ") (double) kind " << theValue->type()->kind() ;
+ }
+ else { // Default
+ CORBA::Object_ptr ObjRef ;
+ try {
+ ObjRef = StringToObject( t ) ;
+ *theValue <<= ObjRef ;
+ }
+ catch( ... ) {
+ *theValue <<= CORBA::Object::_nil() ;
+ }
+ *theValue >>= ObjRef ;
+// cdebug << " --> Value( " << ObjectToString( ObjRef ) << ") (object reference) kind "
+// << theValue->type()->kind() ;
+ }
+ _theValue = theValue ;
+ *_Value = theValue ;
+ }
break;
}
- case CORBA::tk_double: {
- double d;
- *_theValue >>= d;
- cdebug << "Value( " << d << ") (double)";
+ case CORBA::tk_long: { // Input long Value
+ long l;
+ *aDataValue >>= l;
+// cdebug << "Value( " << l << ") (long)";
+ if ( !strcmp( Type , "boolean" ) || !strcmp( Type , "char" ) ||
+ !strcmp( Type , "short" ) || !strcmp( Type , "int" ) || !strcmp( Type , "long" ) ) { // SuperVision Value
+ _theValue = aDataValue ;
+ *_Value = aDataValue ;
+ *_theValue >>= l;
+// cdebug << " == Value( " << l << ") (long)";
+ }
+ else {
+ CORBA::Any * theValue = new CORBA::Any() ;
+ if ( !strcmp( Type , "string" ) ) {
+ char t[40] ;
+ sprintf( t , "%ld" , l ) ;
+ *theValue <<= t ;
+ char *tt ;
+ *theValue >>= tt ;
+// cdebug << " --> Value( " << t << ") (string) kind " << theValue->type()->kind() ;
+ }
+ else if ( !strcmp( Type , "float" ) || !strcmp( Type , "double" ) ) {
+ double d = l ;
+ *theValue <<= d ;
+ *theValue >>= d ;
+// cdebug << " --> Value( " << d << ") (double) kind " << theValue->type()->kind() ;
+ }
+ else { // Default
+ CORBA::Object_ptr ObjRef ;
+ *theValue <<= CORBA::Object::_nil() ;
+ *theValue >>= ObjRef ;
+// cdebug << " --> Value( " << ObjectToString( ObjRef ) << ") (object reference) kind "
+// << theValue->type()->kind() ;
+ }
+ _theValue = theValue ;
+ *_Value = theValue ;
+ }
break;
}
- case CORBA::tk_long: {
- long l;
- *_theValue >>= l;
- cdebug << "Value( " << l << ") (long)";
+ case CORBA::tk_double: { // Input double Value
+ double d;
+ *aDataValue >>= d;
+// cdebug << "Value( " << d << ") (double)";
+ if ( !strcmp( Type , "float" ) || !strcmp( Type , "double" ) ) { // SuperVision Value
+ _theValue = aDataValue ;
+ *_Value = aDataValue ;
+ *_theValue >>= d;
+// cdebug << " == Value( " << d << ") (double)";
+ }
+ else {
+ CORBA::Any * theValue = new CORBA::Any() ;
+ if ( !strcmp( Type , "string" ) ) {
+ char t[40] ;
+ sprintf( t , "%lf" , d ) ;
+ *theValue <<= t ;
+ char *tt ;
+ *theValue >>= tt ;
+// cdebug << " --> Value( " << t << ") (string) kind " << theValue->type()->kind() ;
+ }
+ else if ( !strcmp( Type , "boolean" ) || !strcmp( Type , "char" ) ||
+ !strcmp( Type , "short" ) || !strcmp( Type , "int" ) || !strcmp( Type , "long" ) ) {
+ long l = (long ) d ;
+ *theValue <<= l ;
+ *theValue >>= l;
+// cdebug << " --> Value( " << l << ") (long) kind " << theValue->type()->kind() ;
+ }
+ else { // Default
+ CORBA::Object_ptr ObjRef ;
+ *theValue <<= CORBA::Object::_nil() ;
+ *theValue >>= ObjRef ;
+// cdebug << " --> Value( " << ObjectToString( ObjRef ) << ") (object reference) kind "
+// << theValue->type()->kind() ;
+ }
+ _theValue = theValue ;
+ *_Value = theValue ;
+ }
break;
}
- case CORBA::tk_objref: {
- cdebug << "Value( " << ") (object reference)";
+ case CORBA::tk_objref: { // Input objref Value
+ CORBA::Object_ptr obj ;
+ *aDataValue >>= obj;
+// cdebug << "Value( " << ObjectToString( obj ) << ") (object reference)";
+ if ( strcmp( Type , "string" ) &&
+ strcmp( Type , "boolean" ) && strcmp( Type , "char" ) &&
+ strcmp( Type , "short" ) && strcmp( Type , "long" ) &&
+ strcmp( Type , "double" ) ) { // SuperVision Default Value
+ _theValue = aDataValue ;
+ *_Value = aDataValue ;
+ *_theValue >>= obj;
+// cdebug << " == Value( " << ObjectToString( obj ) << ") (object reference)";
+ }
+ else {
+ CORBA::Any * theValue = new CORBA::Any() ;
+ if ( !strcmp( Type , "string" ) ) {
+ *theValue <<= ObjectToString( obj ) ;
+ *theValue >>= obj ;
+// cdebug << " --> Value( " << ObjectToString( obj ) << ") (string) kind " << theValue->type()->kind() ;
+ }
+ else if ( !strcmp( Type , "boolean" ) || !strcmp( Type , "char" ) ||
+ !strcmp( Type , "short" ) || !strcmp( Type , "int" ) || !strcmp( Type , "long" ) ) {
+ long l = (long ) obj ;
+ *theValue <<= l ;
+ *theValue >>= l;
+// cdebug << " --> Value( " << l << ") (long) kind " << theValue->type()->kind() ;
+ }
+ else if ( !strcmp( Type , "float" ) || !strcmp( Type , "double" ) ) {
+ double d = (double ) 0. ;
+ *theValue <<= d ;
+ *theValue >>= d;
+// cdebug << " --> Value( " << d << ") (double) kind " << theValue->type()->kind() ;
+ }
+ _theValue = theValue ;
+ *_Value = theValue ;
+ }
break;
}
default: {
- cdebug << "Value" << " (other(tk_string,tk_double,tk_long,tk_objref)) ERROR";
+ cdebug << "Value" << " (other(tk_string,tk_double,tk_long,tk_objref)) ERROR kind "
+ << aDataValue->type()->kind() ;
break;
}
}
cdebug << endl ;
-#endif
if ( pthread_mutex_unlock( &_MutexWait ) ) {
perror( "unlock DataValue" ) ;
exit( 0 ) ;
const CORBA::Any *const Value = *_Value ;
CORBA::Any * theValue ;
// cdebug << pthread_self() << " Value " << NodeName() << " " << PortName() << " "
-// << PortType() << " _Value " << _Value << " *_Value " << *_Value << " kind "
-// << Value->type()->kind() << " :" << endl ;
+// << PortType() << " _Value " << _Value << " *_Value " << *_Value << " Value->type "
+// << Value->type() ;
+ if ( Value->type() ) {
+// cdebug << " kind " << Value->type()->kind() << " :" << endl ;
+ }
+ else {
+// cdebug << " Null" << endl ;
+ }
if ( Done() ) {
theValue = new CORBA::Any( *Value ) ;
switch ( theValue->type()->kind() ) {
break;
}
default: {
- cdebug << "GraphBase::DataPort::Value() : "
- << "(other(tk_string,tk_double,tk_long,tk_objref)) ERROR" << endl ;
+ cdebug << "GraphBase::DataPort::Value() : " << NodeName() << "( " << PortName() << " ) " << PortType()
+ << " (other(tk_string,tk_double,tk_long,tk_objref)) ERROR" << endl ;
break;
}
}