forked from panda3d/panda3d
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnodePointerToBase.h
More file actions
63 lines (51 loc) · 1.76 KB
/
nodePointerToBase.h
File metadata and controls
63 lines (51 loc) · 1.76 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
/**
* PANDA 3D SOFTWARE
* Copyright (c) Carnegie Mellon University. All rights reserved.
*
* All use of this software is subject to the terms of the revised BSD
* license. You should have received a copy of this license along
* with this source code in a file named "LICENSE."
*
* @file nodePointerToBase.h
* @author drose
* @date 2005-05-07
*/
#ifndef NODEPOINTERTOBASE_H
#define NODEPOINTERTOBASE_H
#include "pandabase.h"
#include "pointerToVoid.h"
#include "memoryUsage.h"
#include "config_express.h"
/**
* This is similar to PointerToBase, but it manages objects of type
* NodeReferenceCount or NodeCachedReferenceCount, and it updates the
* node_ref_count instead of the regular ref_count. It is intended for use
* only in PandaNode, to hold a pointer to RenderState and TransformState,
* although it could be used by any object that wanted to maintain a separate
* reference count for reporting purposes.
*/
template <class T>
class NodePointerToBase : public PointerToVoid {
public:
typedef T To;
protected:
INLINE NodePointerToBase(To *ptr);
INLINE NodePointerToBase(const NodePointerToBase<T> ©);
INLINE ~NodePointerToBase();
INLINE NodePointerToBase(NodePointerToBase<T> &&from) noexcept;
INLINE void reassign(NodePointerToBase<To> &&from) noexcept;
void reassign(To *ptr);
INLINE void reassign(const NodePointerToBase<To> ©);
// No assignment or retrieval functions are declared in NodePointerToBase,
// because we will have to specialize on const vs. non-const later.
PUBLISHED:
INLINE void clear();
void output(std::ostream &out) const;
};
template<class T>
INLINE std::ostream &operator <<(std::ostream &out, const NodePointerToBase<T> &pointer) {
pointer.output(out);
return out;
}
#include "nodePointerToBase.I"
#endif