Panda3D
 All Classes Functions Variables Enumerations
nodePointerToBase.h
1 // Filename: nodePointerToBase.h
2 // Created by: drose (07May05)
3 //
4 ////////////////////////////////////////////////////////////////////
5 //
6 // PANDA 3D SOFTWARE
7 // Copyright (c) Carnegie Mellon University. All rights reserved.
8 //
9 // All use of this software is subject to the terms of the revised BSD
10 // license. You should have received a copy of this license along
11 // with this source code in a file named "LICENSE."
12 //
13 ////////////////////////////////////////////////////////////////////
14 
15 #ifndef NODEPOINTERTOBASE_H
16 #define NODEPOINTERTOBASE_H
17 
18 #include "pandabase.h"
19 #include "pointerToVoid.h"
20 #include "memoryUsage.h"
21 #include "config_express.h"
22 
23 ////////////////////////////////////////////////////////////////////
24 // Class : NodePointerToBase
25 // Description : This is similar to PointerToBase, but it manages
26 // objects of type NodeReferenceCount or
27 // NodeCachedReferenceCount, and it updates the
28 // node_ref_count instead of the regular ref_count. It
29 // is intended for use only in PandaNode, to hold a
30 // pointer to RenderState and TransformState, although
31 // it could be used by any object that wanted to
32 // maintain a separate reference count for reporting
33 // purposes.
34 ////////////////////////////////////////////////////////////////////
35 template <class T>
37 public:
38  typedef T To;
39 
40 protected:
41  INLINE NodePointerToBase(To *ptr);
42  INLINE NodePointerToBase(const NodePointerToBase<T> &copy);
43  INLINE ~NodePointerToBase();
44 
45 #ifdef USE_MOVE_SEMANTICS
46  INLINE NodePointerToBase(NodePointerToBase<T> &&from) NOEXCEPT;
47  INLINE void reassign(NodePointerToBase<To> &&from) NOEXCEPT;
48 #endif
49 
50  void reassign(To *ptr);
51  INLINE void reassign(const NodePointerToBase<To> &copy);
52 
53  // No assignment or retrieval functions are declared in
54  // NodePointerToBase, because we will have to specialize on const
55  // vs. non-const later.
56 
57 PUBLISHED:
58  INLINE void clear();
59 
60  void output(ostream &out) const;
61 };
62 
63 template<class T>
64 INLINE ostream &operator <<(ostream &out, const NodePointerToBase<T> &pointer) {
65  pointer.output(out);
66  return out;
67 }
68 
69 #include "nodePointerToBase.I"
70 
71 #endif
void output(ostream &out) const
A handy function to output NodePointerTo&#39;s as a hex pointer followed by a reference count...
void clear()
A convenient way to set the NodePointerTo object to NULL.
This is similar to PointerToBase, but it manages objects of type NodeReferenceCount or NodeCachedRefe...
This is the non-template part of the base class for PointerTo and ConstPointerTo. ...
Definition: pointerToVoid.h:36