Lucene++ - a full-featured, c++ search engine
API Documentation

- Main Page
- Related Pages
- Namespaces
- Data Structures
- Files

- File List
- Globals

CycleCheck.h
Go to the documentation of this file.
1 // Copyright (c) 2009-2014 Alan Wright. All rights reserved.
3 // Distributable under the terms of either the Apache License (Version 2.0)
4 // or the GNU Lesser General Public License.
6
7 #ifndef CYCLECHECK_H
8 #define CYCLECHECK_H
9
10 #include "Lucene.h"
11
12 namespace Lucene {
13
15 class LPPAPI CycleCheck {
16 public:
17 virtual ~CycleCheck();
18
19 protected:
20 static MapStringInt cycleMap;
21 static Set<LuceneObjectPtr*> staticRefs;
22
23 protected:
24 void addRef(const String& className, int32_t ref);
25 static void addStatic(LuceneObjectPtr* staticRef);
26
27 public:
28 template <class TYPE>
29 static void addStatic(TYPE& staticRef) {
30 addStatic(reinterpret_cast<LuceneObjectPtr*>(&staticRef));
31 }
32
33 static void dumpRefs();
34 };
35
36 template <class TYPE>
37 class CycleCheckT : public CycleCheck {
38 public:
39 CycleCheckT() {
40 addRef(TYPE::_getClassName(), 1);
41 }
42
43 virtual ~CycleCheckT() {
44 addRef(TYPE::_getClassName(), -1);
45 }
46 };
47
48 }
49
50 #endif
Lucene::CycleCheck
Debug utility to track shared_ptr utilization.
Definition: CycleCheck.h:15
Lucene::LuceneObjectPtr
boost::shared_ptr< LuceneObject > LuceneObjectPtr
Definition: LuceneTypes.h:539
Lucene::CycleCheck::cycleMap
static MapStringInt cycleMap
Definition: CycleCheck.h:20
Lucene::CycleCheckT::~CycleCheckT
virtual ~CycleCheckT()
Definition: CycleCheck.h:43
Lucene::CycleCheck::addStatic
static void addStatic(TYPE &staticRef)
Definition: CycleCheck.h:29
Lucene::CycleCheckT::CycleCheckT
CycleCheckT()
Definition: CycleCheck.h:39
Lucene
Definition: AbstractAllTermDocs.h:12
Lucene::Set< LuceneObjectPtr * >
Lucene::CycleCheckT
Definition: CycleCheck.h:37
Lucene::CycleCheck::staticRefs
static Set< LuceneObjectPtr * > staticRefs
Definition: CycleCheck.h:21
Lucene::CycleCheck::addRef
void addRef(const String &className, int32_t ref)

clucene.sourceforge.net