Panda3D
 All Classes Functions Variables Enumerations
weakNodePath.h
1 // Filename: weakNodePath.h
2 // Created by: drose (29Sep04)
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 WEAKNODEPATH_H
16 #define WEAKNODEPATH_H
17 
18 #include "pandabase.h"
19 
20 #include "nodePath.h"
21 #include "nodePathComponent.h"
22 #include "weakPointerTo.h"
23 
24 ////////////////////////////////////////////////////////////////////
25 // Class : WeakNodePath
26 // Description : This class is a wrapper around a NodePath that,
27 // unlike the actual NodePath class, doesn't hold a
28 // reference count to the node. Thus the node may be
29 // detached from the scene graph and destructed at any
30 // time.
31 //
32 // You can call is_valid() or was_deleted() at any time
33 // to determine whether the node is still around; if it
34 // is, get_node_path() will return the associated
35 // NodePath.
36 ////////////////////////////////////////////////////////////////////
37 class EXPCL_PANDA_PGRAPH WeakNodePath {
38 public:
39  INLINE WeakNodePath(const NodePath &node_path);
40  INLINE WeakNodePath(const WeakNodePath &copy);
41  INLINE ~WeakNodePath();
42 
43  INLINE void operator = (const NodePath &node_path);
44  INLINE void operator = (const WeakNodePath &copy);
45 
46  INLINE bool is_empty() const;
47  INLINE bool was_deleted() const;
48 
49  INLINE NodePath get_node_path() const;
50  INLINE PandaNode *node() const;
51 
52  INLINE bool operator == (const NodePath &other) const;
53  INLINE bool operator != (const NodePath &other) const;
54  INLINE bool operator < (const NodePath &other) const;
55  INLINE int compare_to(const NodePath &other) const;
56 
57  INLINE bool operator == (const WeakNodePath &other) const;
58  INLINE bool operator != (const WeakNodePath &other) const;
59  INLINE bool operator < (const WeakNodePath &other) const;
60  INLINE int compare_to(const WeakNodePath &other) const;
61 
62  INLINE int get_key() const;
63 
64  void output(ostream &out) const;
65 
66 private:
67  WPT(NodePathComponent) _head;
68  int _backup_key;
69 };
70 
71 INLINE ostream &operator << (ostream &out, const WeakNodePath &node_path);
72 
73 #include "weakNodePath.I"
74 
75 #endif
A basic node of the scene graph or data graph.
Definition: pandaNode.h:72
This class is a wrapper around a NodePath that, unlike the actual NodePath class, doesn&#39;t hold a refe...
Definition: weakNodePath.h:37
An STL function object class, this is intended to be used on any ordered collection of class objects ...
Definition: stl_compares.h:79
NodePath is the fundamental system for disambiguating instances, and also provides a higher-level int...
Definition: nodePath.h:165
This is one component of a NodePath.