From f24f58c3334bc97388e29e1b806b1a77cd4809a7 Mon Sep 17 00:00:00 2001 From: rahuel Date: Fri, 22 Apr 2005 07:10:05 +0000 Subject: [PATCH] AddWithoutSleep method added for Graphs of check of Memory Leaks --- idl/AddComponent.idl | 2 + resources/COMPONENTCatalog.xml | 149 +++++++++++++++++++++++++ src/AddComponent/AddComponent_Impl.cxx | 32 ++++++ src/AddComponent/AddComponent_Impl.hxx | 2 + src/AddComponent/Adder_Impl.hxx | 40 ++++--- 5 files changed, 207 insertions(+), 18 deletions(-) diff --git a/idl/AddComponent.idl b/idl/AddComponent.idl index 8e504d4..c52db3a 100644 --- a/idl/AddComponent.idl +++ b/idl/AddComponent.idl @@ -37,12 +37,14 @@ module SuperVisionTest { boolean AdditionObjRef1( out Adder anAdder ) ; void AdditionObjRef2( out boolean FuncValue , out Adder anAdder ) ; double Add( in double x , in double y , out double z ) ; + double AddWithoutSleep( in double x , in double y , out double z ) ; long Sigma( in long n ) ; double LastResult() ; }; interface Adder : Engines::Component { double Add( in double x , in double y , out double z ) ; + double AddWithoutSleep( in double x , in double y , out double z ) ; double AddAndCompare( in double x , in double y , in Adder anOtherAdder, out double z ) ; void SetLastResult( in double z ) ; diff --git a/resources/COMPONENTCatalog.xml b/resources/COMPONENTCatalog.xml index ead7e5d..62b22f7 100644 --- a/resources/COMPONENTCatalog.xml +++ b/resources/COMPONENTCatalog.xml @@ -43,6 +43,29 @@ + + + AdditionObjRef + MTJ + 1.0 + Floating add + 1 + + + + + + boolean + FuncValue + Test + + + SuperVisionTest::Adder + Adder + Adder object + + + Add @@ -76,6 +99,39 @@ + + + AddWithoutSleep + MTJ + 1.0 + Floating add + 1 + + + + double + x + First number + + + double + y + Second number + + + + + double + FuncValue + Substract result + + + double + z + Addition result + + + Sigma JR @@ -1986,5 +2042,98 @@ + + SIGNALSComponent + SIGNALSComponent + OTHER + jr + 1 + unknown + 1 + + + + SIGNALSComponent + unknown + + + SIGSEGVfunc + jr + 1 + unknown + 0 + + + + return + long + unknown + + + + + + SIGFPEfunc + jr + 1 + unknown + 0 + + + a + long + unknown + + + b + long + unknown + + + + + return + long + unknown + + + + + + + + + UndefinedSymbolComponent + UndefinedSymbolComponent + OTHER + jr + 1 + unknown + 1 + + + + UndefinedSymbolComponent + unknown + + + UndefinedSymbol + jr + 1 + unknown + 0 + + + + return + long + unknown + + + + + + + diff --git a/src/AddComponent/AddComponent_Impl.cxx b/src/AddComponent/AddComponent_Impl.cxx index f20b3fb..0dbb2cc 100644 --- a/src/AddComponent/AddComponent_Impl.cxx +++ b/src/AddComponent/AddComponent_Impl.cxx @@ -49,6 +49,7 @@ AddComponent_Impl::AddComponent_Impl( CORBA::ORB_ptr orb, _thisObj = this ; _id = _poa->activate_object(_thisObj); LastAddition = 0 ; + CallCount = 0 ; } AddComponent_Impl::AddComponent_Impl() { @@ -124,6 +125,23 @@ double AddComponent_Impl::Add( double x , double y , double & z ) { return (x - y) ; } +double AddComponent_Impl::AddWithoutSleep( double x , double y , double & z ) { + beginService( " AddComponent_Impl::AddWithoutSleep" ); + z = x + y ; + LastAddition = z ; + if ( !strcmp( graphName() , "GraphGOTOAddMemory" ) ) { + CallCount += 1 ; + if ( CallCount == 10000 ) { + MESSAGE( " AddComponent_Impl::AddWithoutSleep pthread_exit CallCount " << CallCount ); + endService( " AddComponent_Impl::AddWithoutSleep pthread_exit" ); + pthread_exit( (void * ) NULL ) ; + } + } + MESSAGE( " AddComponent_Impl::AddWithoutSleep CallCount " << CallCount ); + endService( " AddComponent_Impl::AddWithoutSleep" ); + return (x - y) ; +} + long AddComponent_Impl::Sigma( long n ) { long sigma = 0 ; int i , j ; @@ -197,6 +215,13 @@ Adder_Impl::~Adder_Impl() { endService( "Adder_Impl::~Adder_Impl" ); } +void Adder_Impl::destroy() { + _poa->deactivate_object(*_id) ; + CORBA::release(_poa) ; + delete(_id) ; + _thisObj->_remove_ref(); +} + double Adder_Impl::Add( double x , double y , double & z ) { beginService( " Adder_Impl::Add" ); z = x + y ; @@ -215,6 +240,13 @@ double Adder_Impl::Add( double x , double y , double & z ) { return -(x - y) ; } +double Adder_Impl::AddWithoutSleep( double x , double y , double & z ) { + beginService( " Adder_Impl::AddWithoutSleep" ); + z = x + y ; + endService( " Adder_Impl::AddWithoutSleep" ); + return -(x - y) ; +} + double Adder_Impl::AddAndCompare( const double x , const double y , const SuperVisionTest::Adder_ptr anOtherAdder , double & z ) { diff --git a/src/AddComponent/AddComponent_Impl.hxx b/src/AddComponent/AddComponent_Impl.hxx index 1914a27..5fc8855 100644 --- a/src/AddComponent/AddComponent_Impl.hxx +++ b/src/AddComponent/AddComponent_Impl.hxx @@ -54,6 +54,7 @@ public: virtual void AdditionObjRef2( bool & FuncValue , SuperVisionTest::Adder_out ) ; virtual double Add( double x , double y , double & z ) ; + virtual double AddWithoutSleep( double x , double y , double & z ) ; virtual long Sigma( long n ) ; @@ -62,6 +63,7 @@ public: private: double LastAddition ; + long CallCount ; }; diff --git a/src/AddComponent/Adder_Impl.hxx b/src/AddComponent/Adder_Impl.hxx index 078414e..4b4696e 100644 --- a/src/AddComponent/Adder_Impl.hxx +++ b/src/AddComponent/Adder_Impl.hxx @@ -37,31 +37,35 @@ class Adder_Impl : public POA_SuperVisionTest::Adder , public Engines_Component_i { -public: - Adder_Impl() ; - Adder_Impl( CORBA::ORB_ptr orb , - PortableServer::POA_ptr poa , - PortableServer::ObjectId * contId , - const char *instanceName , - const char *interfaceName , - const char * graphName , - const char * nodeName ); + public: + Adder_Impl() ; + Adder_Impl( CORBA::ORB_ptr orb , + PortableServer::POA_ptr poa , + PortableServer::ObjectId * contId , + const char *instanceName , + const char *interfaceName , + const char * graphName , + const char * nodeName ); - virtual ~Adder_Impl(); + virtual ~Adder_Impl(); - virtual double Add( double x , double y , double & z ) ; + virtual void destroy() ; - virtual double AddAndCompare( const double x , const double y , - const SuperVisionTest::Adder_ptr anOtherAdder , - double & z ) ; + virtual double Add( double x , double y , double & z ) ; - virtual void SetLastResult( double z ) ; + virtual double AddWithoutSleep( double x , double y , double & z ) ; - virtual void LastResult( double & z ) ; + virtual double AddAndCompare( const double x , const double y , + const SuperVisionTest::Adder_ptr anOtherAdder , + double & z ) ; -private: + virtual void SetLastResult( double z ) ; - double LastAddition ; + virtual void LastResult( double & z ) ; + + private: + + double LastAddition ; }; -- 2.39.2