Ice 3.7 C++11 API Reference
GCObject.h
Go to the documentation of this file.
1 //
2 // Copyright (c) ZeroC, Inc. All rights reserved.
3 //
4 
5 #ifndef ICE_GC_OBJECT_H
6 #define ICE_GC_OBJECT_H
7 
8 #ifndef ICE_CPP11_MAPPING
9 
10 #include <Ice/Object.h>
11 
12 #include <IceUtil/MutexPtrLock.h>
13 #include <IceUtil/Mutex.h>
14 
15 namespace IceInternal
16 {
17 
18 class GCObject;
19 
20 class GCVisitor
21 {
22 public:
23 
24  virtual ~GCVisitor()
25  {
26  }
27 
28  virtual bool visit(GCObject*) = 0;
29 };
30 
31 class ICE_API GCObject : public virtual Ice::Object
32 {
33 public:
34 
35  //
36  // Flags constant used for collection of graphs
37  //
38  static const unsigned char Collectable;
39  static const unsigned char CycleMember;
40  static const unsigned char Visiting;
41 
42  //
43  // Override IceUtil::Shared methods
44  //
45  virtual void __incRef();
46  virtual void __decRef();
47  virtual int __getRef() const;
48  virtual void __setNoDelete(bool);
49 
50  //
51  // Override Object methods
52  //
53  virtual bool _iceGcVisit(GCVisitor&);
54  virtual void ice_collectable(bool);
55 
56  //
57  // This method is implemented by Slice classes to visit class
58  // members.
59  //
60  virtual void _iceGcVisitMembers(IceInternal::GCVisitor&) = 0;
61 
62  int _iceGetRefUnsafe()
63  {
64  return _ref;
65  }
66 
67 private:
68 
69  bool collect(IceUtilInternal::MutexPtrLock<IceUtil::Mutex>&);
70 };
71 
72 }
73 
74 #endif
75 
76 #endif
Ice::Object
The base class for servants.
Definition: Object.h:91
ICE_API
#define ICE_API
Definition: Config.h:197
MutexPtrLock.h
Object.h
Mutex.h