GraphBase::DataPort::DataPort() :
Port() {
pthread_mutex_init( &_MutexWait , NULL ) ;
- _State = SUPERV::UndefinedState ;
+ _PortState = SUPERV::UndefinedState ;
_Done = false ;
InitialValues( CORBA::Any() ) ;
}
const SALOME_ModuleCatalog::DataStreamDependency aDependency ) :
Port( NodeName , aserviceParameter , aKind , aDependency ) {
pthread_mutex_init( &_MutexWait , NULL ) ;
- _State = SUPERV::UndefinedState ;
+ _PortState = SUPERV::UndefinedState ;
_Done = false ;
InitialValues( CORBA::Any() ) ;
}
void GraphBase::DataPort::InitialValues(CORBA::Any aValue ) {
_theValue = new CORBA::Any( aValue ) ;
- string _Type = CORBA::string_dup(GetServicesParameter().Parametertype) ;
+//JR 24.02.2005 Memory Leak string _Type = CORBA::string_dup(GetServicesParameter().Parametertype) ;
+ string _Type = string( GetServicesParameter().Parametertype ) ;
const char * Type = _Type.c_str();
CORBA::Any InitialValue ;
cdebug << "InitialValues " << NodeName() << " " << PortName() << " " << PortType()
delete _theValue ;
- string _Type = CORBA::string_dup( GetServicesParameter().Parametertype ) ;
- const char * Type = _Type.c_str() ;
+//JR 21.02.2005 Debug Memory leak : string _Type = CORBA::string_dup( GetServicesParameter().Parametertype ) ;
+// const char * Type = _Type.c_str() ;
+ const char * Type = GetServicesParameter().Parametertype ;
_Value = &_theValue ;
cdebug << "NewValue " << NodeName() << " " << PortName() << " " << PortType()
<< " : " << aDataValue << " kind " << aDataValue->type()->kind() << " " ;
}
_theValue = theValue ;
*_Value = theValue ;
+//JR 21.02.2005 Debug Memory leak :
+ delete aDataValue ;
}
break;
}
}
_theValue = theValue ;
*_Value = theValue ;
+//JR 21.02.2005 Debug Memory leak :
+ delete aDataValue ;
}
break;
}
}
_theValue = theValue ;
*_Value = theValue ;
+//JR 21.02.2005 Debug Memory leak :
+ delete aDataValue ;
}
break;
}
}
_theValue = theValue ;
*_Value = theValue ;
+//JR 21.02.2005 Debug Memory leak :
+ delete aDataValue ;
}
break;
}
}
-void GraphBase::DataPort::Value( const CORBA::Any ** aDataSharedValue ) {
- delete _theValue ;
- _theValue = *aDataSharedValue ;
- _Value = aDataSharedValue ;
-// Done( true ) ;
-
-#if 0
- MESSAGE( NodePortName() << " : " << hex << _Value << " " );
- switch (_theValue->type()->kind()) {
- case CORBA::tk_string:
- char * t;
- *_theValue >>= t;
- MESSAGE( "Value( " << t << ") (string)");
- break;
- case CORBA::tk_double:
- double d;
- *_theValue >>= d;
- MESSAGE( "Value( " << d << ") (double)");
- break;
- case CORBA::tk_long:
- long l;
- *_theValue >>= l;
- MESSAGE( "Value( " << l << ") (long)");
- break;
- case CORBA::tk_objref:
- MESSAGE( "Value( " << ") (object reference)");
- break;
- default:
- MESSAGE( "Value" << " (other(tk_string,tk_double,tk_long,tk_objref)) ERROR");
- break;
- }
- MESSAGE();
-#endif
-}
-
CORBA::Any const * GraphBase::DataPort::Value() const {
pthread_mutex_t * aMutexWait = (pthread_mutex_t *) &_MutexWait ;
// cdebug << pthread_self() << " Value() --> pthread_mutex_lock " << aMutexWait << endl ;
else {
// cdebug << " Null" << endl ;
}
- if ( Done() ) {
- theValue = new CORBA::Any( *Value ) ;
+ if ( PortDone() ) {
+//JR 21.02.2005 Debug Memory leak : theValue = new CORBA::Any( *Value ) ;
+ theValue = (CORBA::Any * ) Value ;
switch ( theValue->type()->kind() ) {
case CORBA::tk_string: {
char * t;
}
else {
// cdebug << "GraphBase::DataPort::InitialValue() " << endl ;
- theValue = new CORBA::Any( *Value ) ;
+//JR 21.02.2005 Debug Memory leak : theValue = new CORBA::Any( *Value ) ;
+ theValue = (CORBA::Any * ) Value ;
}
if ( pthread_mutex_unlock( aMutexWait ) ) {
perror( "unlock DataValue" ) ;
bool GraphBase::DataPort::BoolValue() const {
bool RetVal = false ;
- long val ;
pthread_mutex_t * aMutexWait = (pthread_mutex_t *) &_MutexWait ;
// cdebug << pthread_self() << " BoolValue() --> pthread_mutex_lock " << aMutexWait << endl ;
if ( pthread_mutex_lock( aMutexWait ) ) {
// cdebug << pthread_self() << " BoolValue() --> pthread_mutex_locked " << aMutexWait
// << endl ;
if ( (*_Value)->type()->kind() == CORBA::tk_long ) {
+ long val ;
+ **_Value >>= val ;
+ if ( val ) {
+ RetVal = true ;
+ }
+ }
+ else if ( (*_Value)->type()->kind() == CORBA::tk_boolean ) {
+ bool val ;
**_Value >>= val ;
if ( val ) {
RetVal = true ;
perror( "unlock DataValue" ) ;
exit( 0 ) ;
}
-// cdebug << pthread_self() << " BoolValue() --> pthread_mutex_unlocked " << aMutexWait
-// << endl ;
+ cdebug << pthread_self() << " " << NodeName() << "( " << PortName() << " ) BoolValue " << RetVal << endl ;
return RetVal ;
}
-const CORBA::Any ** GraphBase::DataPort::ValuePtr() const {
- return _Value ;
-}
-
void GraphBase::DataPort::StringValue(ostream & f ) const {
pthread_mutex_t * aMutexWait = (pthread_mutex_t *) &_MutexWait ;
// cdebug << pthread_self() << " StringValue() --> pthread_mutex_lock " << aMutexWait
}
// cdebug << pthread_self() << " StringValue() --> pthread_mutex_locked " << aMutexWait
// << endl ;
- if ( Done() ) {
+ if ( PortDone() ) {
// cdebug << "StringValue " << NodeName() << " " << PortName() << " " << PortType()
// << " _Value " << _Value << " *_Value "
// << *_Value << " " << endl ;
}
}
else {
- f << " Default (undefined) NOT DONE" ;
+ f << " Default (undefined) DATAPORT NOT DONE" ;
}
if ( pthread_mutex_unlock( aMutexWait ) ) {
perror( "unlock DataValue" ) ;
CORBA::Any const * _InitialValue ;
CORBA::Any const * _theValue ;
CORBA::Any const * * _Value ;
- SUPERV::GraphState _State ;
+//JR 08.03.2005 : the fields (and corresponding methods) _PortState and _Done are redundant
+// probably. That should be clarified when I shall have time enough
+ SUPERV::GraphState _PortState ;
bool _Done ;
pthread_mutex_t _MutexWait ;
+ void Value( const CORBA::Any * aValue ) ;
+
public :
DataPort() ;
void InitialValues(CORBA::Any aValue ) ;
void Value (const CORBA::Any & aValue ) ;
- void Value( const CORBA::Any * aValue ) ;
- void Value( const CORBA::Any ** aValue ) ;
+// void Value( const CORBA::Any * aValue ) ;
+// void Value( const CORBA::Any ** aValue ) ;
CORBA::Any const * Value() const ;
bool BoolValue() const ;
- const CORBA::Any ** ValuePtr() const ;
+// const CORBA::Any ** ValuePtr() const ;
- void State( SUPERV::GraphState aState ) {
- _State = aState ; } ;
- SUPERV::GraphState State() { return _State ; } ;
+ void PortState( SUPERV::GraphState aPortState ) {
+ _PortState = aPortState ; } ;
+ SUPERV::GraphState PortState() { return _PortState ; } ;
- void Done( bool aDone ) {
+ void PortDone( bool aDone ) {
// cdebug << "ChgDone(.) " << NodeName() << " " << PortName() << " "
// << _Done << " -> " << aDone << endl ;
_Done = aDone ; } ;
- const bool Done() const { return ( _Done ) ; } ;
+ const bool PortDone() const { return ( _Done ) ; } ;
void StringValue(ostream & f) const ;