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