RCFProto

- Main Page
- Classes
- Files

- File List

All Classes Functions Typedefs
SpCollector.hpp
1
2 //******************************************************************************
3 // RCF - Remote Call Framework
4 //
5 // Copyright (c) 2005 - 2013, Delta V Software. All rights reserved.
6 // http://www.deltavsoft.com
7 //
8 // RCF is distributed under dual licenses - closed source or GPL.
9 // Consult your particular license for conditions of use.
10 //
11 // If you have not purchased a commercial license, you are using RCF
12 // under GPL terms.
13 //
14 // Version: 2.0
15 // Contact: support <at> deltavsoft.com
16 //
17 //******************************************************************************
18
19 #ifndef INCLUDE_RCF_UTIL_SPCOLLECTOR_HPP
20 #define INCLUDE_RCF_UTIL_SPCOLLECTOR_HPP
21
22 #if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) && !defined(__MINGW32__)
23
24 // this causes naming collisions for classes named "X" in RCF tests...
25 //#include <boost/config/../../libs/smart_ptr/src/sp_collector.cpp>
26
27 // exported from sp_collector.cpp
28 std::size_t find_unreachable_objects(bool report);
29 void free_unreachable_objects();
30
31 void checkNoCycles()
32 {
33 std::cout << "Checking for shared_ptr cycles..." << std::endl;
34 std::size_t count = find_unreachable_objects(true);
35 if (count > 0)
36 {
37 std::cout << "Detected shared_ptr cycles! Unreachable objects: " << count << std::endl;
38 abort();
39 }
40 else
41 {
42 std::cout << "No shared_ptr cycles detected." << std::endl;
43 }
44 }
45
46 #else
47
48 void checkNoCycles()
49 {
50 std::cout << "shared_ptr cycle detection not enabled." << std::endl;
51 }
52
53 #endif
54
55 #endif // ! INCLUDE_RCF_UTIL_SPCOLLECTOR_HPP