|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r52178 - in sandbox/pinhole: boost/pinhole libs/pinhole/build libs/pinhole/src libs/pinhole/test
From: jmcintyre_at_[hidden]
Date: 2009-04-04 19:08:36
Author: jared
Date: 2009-04-04 19:08:35 EDT (Sat, 04 Apr 2009)
New Revision: 52178
URL: http://svn.boost.org/trac/boost/changeset/52178
Log:
Pinhole is now header only.
Removed:
sandbox/pinhole/libs/pinhole/build/
sandbox/pinhole/libs/pinhole/src/
Text files modified:
sandbox/pinhole/boost/pinhole/main.cpp | 4 ---
sandbox/pinhole/boost/pinhole/property_manager.hpp | 44 +++++++++++++++++++--------------------
sandbox/pinhole/libs/pinhole/test/Jamfile.v2 | 1
sandbox/pinhole/libs/pinhole/test/test_property_groups.cpp | 2
4 files changed, 22 insertions(+), 29 deletions(-)
Modified: sandbox/pinhole/boost/pinhole/main.cpp
==============================================================================
--- sandbox/pinhole/boost/pinhole/main.cpp (original)
+++ sandbox/pinhole/boost/pinhole/main.cpp 2009-04-04 19:08:35 EDT (Sat, 04 Apr 2009)
@@ -14,10 +14,6 @@
using namespace std;
using namespace boost;
using namespace boost::pinhole;
-
-// I can hide these two line if I don't do everything in headers
-shared_ptr<property_manager> property_manager::m_instance(new property_manager);
-event_source* event_source::m_instance = 0;
class SubGroup : public property_group
{
Modified: sandbox/pinhole/boost/pinhole/property_manager.hpp
==============================================================================
--- sandbox/pinhole/boost/pinhole/property_manager.hpp (original)
+++ sandbox/pinhole/boost/pinhole/property_manager.hpp 2009-04-04 19:08:35 EDT (Sat, 04 Apr 2009)
@@ -1,6 +1,6 @@
// Pinhole property_manager.hpp file
//
-// Copyright Jared McIntyre 2007.
+// Copyright Jared McIntyre 2007-2009.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
@@ -36,12 +36,14 @@
public :
static event_source* instance()
{
- if ( !m_instance ) // is it the first call?
+ static boost::shared_ptr<boost::pinhole::event_source> instance;
+
+ if ( !instance ) // is it the first call?
{
- m_instance.reset( new event_source ); // create sole instance
+ instance.reset( new event_source ); // create sole instance
}
- return m_instance.get(); // address of sole instance
+ return instance.get(); // address of sole instance
}
#if defined(BOOST_MSVC)
@@ -64,15 +66,6 @@
}
private :
-
- #if defined(BOOST_MSVC)
- #pragma warning(push)
- #pragma warning( disable: 4251 )
- #endif
- static boost::shared_ptr<event_source> m_instance;
- #if defined(BOOST_MSVC)
- #pragma warning(pop)
- #endif
event_source(){};
@@ -96,25 +89,22 @@
static instance_type instance()
{
- if ( !m_instance ) // is it the first call?
+ if ( !exists() ) // is it the first call?
{
- m_instance.reset( new property_manager, property_manager::deleter ); // create sole instance
+ internal_instance().reset( new property_manager, property_manager::deleter ); // create sole instance
}
- return m_instance; // address of sole instance
+ return internal_instance(); // address of sole instance
}
static bool exists()
{
- return (m_instance != NULL);
+ return (internal_instance() != NULL);
}
static void delete_instance()
{
- if( m_instance )
- {
- m_instance.reset();
- }
+ internal_instance().reset();
}
protected:
@@ -227,6 +217,16 @@
}
protected:
+
+ /** Provides direct access to the shared_ptr that owns the property_manager singleton. */
+ static boost::shared_ptr<boost::pinhole::property_manager>& internal_instance()
+ {
+ static boost::shared_ptr<boost::pinhole::property_manager>
+ instance(new boost::pinhole::property_manager);
+
+ return instance;
+ }
+
/**
* Register's group with the property_manager.
*/
@@ -276,12 +276,10 @@
}
}
- protected:
#if defined(BOOST_MSVC)
#pragma warning(push)
#pragma warning( disable: 4251 )
#endif
- static std::tr1::shared_ptr<property_manager> m_instance;
category_to_property_group_map m_property_group_collection;
category_collection m_category_collection;
#if defined(BOOST_MSVC)
Modified: sandbox/pinhole/libs/pinhole/test/Jamfile.v2
==============================================================================
--- sandbox/pinhole/libs/pinhole/test/Jamfile.v2 (original)
+++ sandbox/pinhole/libs/pinhole/test/Jamfile.v2 2009-04-04 19:08:35 EDT (Sat, 04 Apr 2009)
@@ -15,7 +15,6 @@
: requirements
<library>/boost/test//boost_unit_test_framework/<link>static
<library>/boost/signals//boost_signals/<link>static
- <library>../build//boost_pinhole/<link>static
<define>BOOST_ALL_NO_LIB=1
;
{
Modified: sandbox/pinhole/libs/pinhole/test/test_property_groups.cpp
==============================================================================
--- sandbox/pinhole/libs/pinhole/test/test_property_groups.cpp (original)
+++ sandbox/pinhole/libs/pinhole/test/test_property_groups.cpp 2009-04-04 19:08:35 EDT (Sat, 04 Apr 2009)
@@ -113,7 +113,7 @@
public:
TestPropertyManager() : property_manager()
{
- property_manager::m_instance.reset( this );
+ property_manager::internal_instance().reset( this );
uiChildCount = 0;
uiRegisterPropertyGroupCallCount = 0;
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk