Panda3D

Loading...
Searching...
No Matches
weakNodePath.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 weakNodePath.h
10 * @author drose
11 * @date 2004-09-29
12 */
13
14#ifndef WEAKNODEPATH_H
15#define WEAKNODEPATH_H
16
17#include "pandabase.h"
18
19#include "nodePath.h"
20#include "nodePathComponent.h"
21#include "weakPointerTo.h"
22
23/**
24 * This class is a wrapper around a NodePath that, unlike the actual NodePath
25 * class, doesn't hold a reference count to the node. Thus the node may be
26 * detached from the scene graph and destructed at any time.
27 *
28 * You can call is_valid() or was_deleted() at any time to determine whether
29 * the node is still around; if it is, get_node_path() will return the
30 * associated NodePath.
31 */
32 class EXPCL_PANDA_PGRAPH WeakNodePath {
33PUBLISHED:
34 INLINE WeakNodePath(const NodePath &node_path);
35 INLINE WeakNodePath(const WeakNodePath &copy);
36 INLINE ~WeakNodePath();
37
38 INLINE void operator = (const NodePath &node_path);
39 INLINE void operator = (const WeakNodePath &copy);
40
41 INLINE void clear();
42
43 INLINE operator bool () const;
44 INLINE bool is_empty() const;
45 INLINE bool was_deleted() const;
46
47 INLINE NodePath get_node_path() const;
48 INLINE PT(PandaNode) node() const;
49
50 INLINE bool operator == (const NodePath &other) const;
51 INLINE bool operator != (const NodePath &other) const;
52 INLINE bool operator < (const NodePath &other) const;
53 INLINE int compare_to(const NodePath &other) const;
54
55 INLINE bool operator == (const WeakNodePath &other) const;
56 INLINE bool operator != (const WeakNodePath &other) const;
57 INLINE bool operator < (const WeakNodePath &other) const;
58 INLINE int compare_to(const WeakNodePath &other) const;
59
60 INLINE int get_key() const;
61
62 void output(std::ostream &out) const;
63
64 private:
65 WPT(NodePathComponent) _head;
66 mutable int _backup_key;
67
68 friend class NodePath;
69};
70
71INLINE std::ostream &operator << (std::ostream &out, const WeakNodePath &node_path);
72
73#include "weakNodePath.I"
74
75#endif
NodePathComponent
This is one component of a NodePath.
Definition nodePathComponent.h:42
PandaNode
A basic node of the scene graph or data graph.
Definition pandaNode.h:65
WeakNodePath
This class is a wrapper around a NodePath that, unlike the actual NodePath class, doesn't hold a refe...
Definition weakNodePath.h:32
WeakNodePath::clear
void clear()
Sets this NodePath to the empty NodePath.
Definition weakNodePath.I:64
WeakNodePath::get_node_path
NodePath get_node_path() const
Returns the NodePath held within this object, or an empty NodePath with the error flag set if the obj...
Definition weakNodePath.I:99
WeakNodePath::is_empty
bool is_empty() const
Returns true if the NodePath contains no nodes, or if it has been deleted.
Definition weakNodePath.I:81
WeakNodePath::was_deleted
bool was_deleted() const
Returns true if the NodePath we were referencing has been quietly deleted outside of the WeakNodePath...
Definition weakNodePath.I:90
nodePathComponent.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
nodePath.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
pandabase.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
weakNodePath.I
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
weakPointerTo.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.