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

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

- File List
- Globals

All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
CycleCheck.h
Go to the documentation of this file.
1 // Copyright (c) 2009-2011 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 {
17 public:
18 virtual ~CycleCheck();
19
20 protected:
21 static MapStringInt cycleMap;
22 static Set<LuceneObjectPtr*> staticRefs;
23
24 protected:
25 void addRef(const String& className, int32_t ref);
26 static void addStatic(LuceneObjectPtr* staticRef);
27
28 public:
29 template <class TYPE>
30 static void addStatic(TYPE& staticRef)
31 {
32 addStatic(reinterpret_cast<LuceneObjectPtr*>(&staticRef));
33 }
34
35 static void dumpRefs();
36 };
37
38 template <class TYPE>
39 class CycleCheckT : public CycleCheck
40 {
41 public:
42 CycleCheckT()
43 {
44 addRef(TYPE::_getClassName(), 1);
45 }
46
47 virtual ~CycleCheckT()
48 {
49 addRef(TYPE::_getClassName(), -1);
50 }
51 };
52 }
53
54 #endif

clucene.sourceforge.net