|
From: <mor...@us...> - 2008-11-19 07:00:17
|
Revision: 3294
http://ecell.svn.sourceforge.net/ecell/?rev=3294&view=rev
Author: moriyoshi
Date: 2008-11-19 07:00:11 +0000 (Wed, 19 Nov 2008)
Log Message:
-----------
* Revert the changes for reference counting because it now suffers from
the finalization order problem.
Modified Paths:
--------------
ecell3/branches/ecell-3.1/ecell/libecs/EcsObject.cpp
ecell3/branches/ecell-3.1/ecell/libecs/EcsObject.hpp
ecell3/branches/ecell-3.1/ecell/libecs/Model.cpp
ecell3/branches/ecell-3.1/ecell/libecs/Model.hpp
ecell3/branches/ecell-3.1/ecell/libecs/System.cpp
ecell3/branches/ecell-3.1/ecell/libecs/System.hpp
Modified: ecell3/branches/ecell-3.1/ecell/libecs/EcsObject.cpp
===================================================================
--- ecell3/branches/ecell-3.1/ecell/libecs/EcsObject.cpp 2008-11-19 00:39:17 UTC (rev 3293)
+++ ecell3/branches/ecell-3.1/ecell/libecs/EcsObject.cpp 2008-11-19 07:00:11 UTC (rev 3294)
@@ -98,21 +98,6 @@
return getPropertyInterface().getClassName();
}
-void intrusive_ptr_add_ref( libecs::EcsObject* anEcsObject )
-{
- // XXX: needs to be atomic
- ++anEcsObject->theRefCount;
-}
-
-void intrusive_ptr_release( libecs::EcsObject* anEcsObject )
-{
- // XXX: needs to be atomic
- if ( --anEcsObject->theRefCount <= 0 )
- {
- delete anEcsObject;
- }
-}
-
#define NULLGETSET_SPECIALIZATION_DEF( TYPE )\
template <> void EcsObject::nullSet<TYPE>( Param<TYPE>::type )\
{\
Modified: ecell3/branches/ecell-3.1/ecell/libecs/EcsObject.hpp
===================================================================
--- ecell3/branches/ecell-3.1/ecell/libecs/EcsObject.hpp 2008-11-19 00:39:17 UTC (rev 3293)
+++ ecell3/branches/ecell-3.1/ecell/libecs/EcsObject.hpp 2008-11-19 07:00:11 UTC (rev 3294)
@@ -481,9 +481,6 @@
class LIBECS_API EcsObject
{
- friend void intrusive_ptr_add_ref( EcsObject* );
- friend void intrusive_ptr_release( EcsObject* );
-
public:
LIBECS_DM_DEFINE_PROPERTIES()
@@ -492,7 +489,7 @@
}
- EcsObject(): theRefCount( 0 )
+ EcsObject()
{
; // do nothing
}
@@ -585,15 +582,8 @@
protected:
Model* theModel;
Handle theHandle;
- int theRefCount;
};
-/// @internal
-void intrusive_ptr_add_ref( libecs::EcsObject* anEcsObject );
-
-/// @internal
-void intrusive_ptr_release( libecs::EcsObject* anEcsObject );
-
// these specializations of nullSet/nullGet are here to avoid spreading
// inline copies of them around. This reduces sizes of DM .so files a bit.
Modified: ecell3/branches/ecell-3.1/ecell/libecs/Model.cpp
===================================================================
--- ecell3/branches/ecell-3.1/ecell/libecs/Model.cpp 2008-11-19 00:39:17 UTC (rev 3293)
+++ ecell3/branches/ecell-3.1/ecell/libecs/Model.cpp 2008-11-19 07:00:11 UTC (rev 3294)
@@ -125,11 +125,7 @@
aVariablePtr->setID( aFullID.getID() );
aVariablePtr->setModel( this );
Handle nextHandle( generateNextHandle() );
- theObjectMap.insert(
- std::make_pair(
- nextHandle,
- boost::intrusive_ptr< EcsObject >(
- aVariablePtr, true ) ) );
+ theObjectMap.insert( std::make_pair( nextHandle, aVariablePtr ) );
aVariablePtr->setHandle( nextHandle );
aContainerSystemPtr->registerVariable( aVariablePtr );
return;
@@ -141,11 +137,7 @@
aProcessPtr->setID( aFullID.getID() );
aProcessPtr->setModel( this );
Handle nextHandle( generateNextHandle() );
- theObjectMap.insert(
- std::make_pair(
- nextHandle,
- boost::intrusive_ptr< EcsObject >(
- aProcessPtr, true ) ) );
+ theObjectMap.insert( std::make_pair( nextHandle, aProcessPtr ) );
aProcessPtr->setHandle( nextHandle );
aContainerSystemPtr->registerProcess( aProcessPtr );
return;
@@ -157,11 +149,7 @@
aSystemPtr->setID( aFullID.getID() );
aSystemPtr->setModel( this );
Handle nextHandle( generateNextHandle() );
- theObjectMap.insert(
- std::make_pair(
- nextHandle,
- boost::intrusive_ptr< EcsObject >(
- aSystemPtr, true ) ) );
+ theObjectMap.insert( std::make_pair( nextHandle, aSystemPtr ) );
aSystemPtr->setHandle( nextHandle );
aContainerSystemPtr->registerSystem( aSystemPtr );
return;
Modified: ecell3/branches/ecell-3.1/ecell/libecs/Model.hpp
===================================================================
--- ecell3/branches/ecell-3.1/ecell/libecs/Model.hpp 2008-11-19 00:39:17 UTC (rev 3293)
+++ ecell3/branches/ecell-3.1/ecell/libecs/Model.hpp 2008-11-19 07:00:11 UTC (rev 3294)
@@ -296,7 +296,7 @@
LoggerBroker theLoggerBroker;
- std::map< Handle, boost::intrusive_ptr< EcsObject > > theObjectMap;
+ std::map< Handle, EcsObject* > theObjectMap;
unsigned int theNextHandleVal;
System* theRootSystemPtr;
Modified: ecell3/branches/ecell-3.1/ecell/libecs/System.cpp
===================================================================
--- ecell3/branches/ecell-3.1/ecell/libecs/System.cpp 2008-11-19 00:39:17 UTC (rev 3293)
+++ ecell3/branches/ecell-3.1/ecell/libecs/System.cpp 2008-11-19 07:00:11 UTC (rev 3294)
@@ -121,6 +121,16 @@
{
getStepper()->removeSystem( this );
}
+
+ std::for_each( theProcessMap.begin(), theProcessMap.end(),
+ ComposeUnary( DeletePtr< Process >(),
+ SelectSecond< ProcessMap::value_type >() ) );
+ std::for_each( theVariableMap.begin(), theVariableMap.end(),
+ ComposeUnary( DeletePtr< Variable >(),
+ SelectSecond< VariableMap::value_type >() ) );
+ std::for_each( theSystemMap.begin(), theSystemMap.end(),
+ ComposeUnary( DeletePtr< System >(),
+ SelectSecond< SystemMap::value_type >() ) );
}
Modified: ecell3/branches/ecell-3.1/ecell/libecs/System.hpp
===================================================================
--- ecell3/branches/ecell-3.1/ecell/libecs/System.hpp 2008-11-19 00:39:17 UTC (rev 3293)
+++ ecell3/branches/ecell-3.1/ecell/libecs/System.hpp 2008-11-19 07:00:11 UTC (rev 3294)
@@ -32,8 +32,6 @@
#ifndef __SYSTEM_HPP
#define __SYSTEM_HPP
-#include <boost/intrusive_ptr.hpp>
-
#include "libecs/Defs.hpp"
#include "libecs/Entity.hpp"
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|