00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef RAUL_SHARED_PTR_HPP
00019 #define RAUL_SHARED_PTR_HPP
00020
00021 #include <cassert>
00022 #include <cstddef>
00023
00024 #ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
00025 #include <iostream>
00026 #include <list>
00027 #include <algorithm>
00028
00029 static std::list<void*> shared_ptr_counters;
00030
00031
00032 namespace boost {
00033
00034 inline void sp_scalar_constructor_hook(void* object, unsigned long cnt, void* ptr) {
00035 assert(std::find(shared_ptr_counters.begin(), shared_ptr_counters.end(),
00036 (void*)object) == shared_ptr_counters.end());
00037 shared_ptr_counters.push_back(object);
00038
00039
00040 }
00041
00042 inline void sp_scalar_destructor_hook(void* object, unsigned long cnt, void* ptr) {
00043 shared_ptr_counters.remove(object);
00044
00045
00046 }
00047
00048 }
00049 #endif // BOOST_SP_ENABLE_DEBUG_HOOKS
00050
00051
00052 #include <boost/shared_ptr.hpp>
00053
00054 #ifdef BOOST_AC_USE_PTHREADS
00055 #error "Boost is using mutex locking for pointer reference counting."
00056 #error "This is VERY slow. Please report your platform to dave@drobilla.net"
00057 #endif
00058
00059 template <typename T> void NullDeleter(T* ptr) {}
00060
00061 #define SharedPtr boost::shared_ptr
00062 #define PtrCast boost::dynamic_pointer_cast
00063
00064 #endif // RAUL_SHARED_PTR_HPP
00065