pgraph: expose WeakNodePath to Python

This commit is contained in:
rdb 2018-05-20 15:56:58 +02:00
parent 140644d8b6
commit 14f118b672
2 changed files with 24 additions and 1 deletions

View File

@ -56,6 +56,24 @@ operator = (const WeakNodePath &copy) {
_backup_key = copy._backup_key;
}
/**
* Sets this NodePath to the empty NodePath. It will no longer point to any
* node.
*/
INLINE void WeakNodePath::
clear() {
_head.clear();
_backup_key = 0;
}
/**
* Returns true if this NodePath points to a valid, non-null node.
*/
INLINE WeakNodePath::
operator bool () const {
return _head.is_valid_pointer();
}
/**
* Returns true if the NodePath contains no nodes, or if it has been deleted.
*/

View File

@ -30,7 +30,7 @@
* associated NodePath.
*/
class EXPCL_PANDA_PGRAPH WeakNodePath {
public:
PUBLISHED:
INLINE WeakNodePath(const NodePath &node_path);
INLINE WeakNodePath(const WeakNodePath &copy);
INLINE ~WeakNodePath();
@ -38,6 +38,9 @@ public:
INLINE void operator = (const NodePath &node_path);
INLINE void operator = (const WeakNodePath &copy);
INLINE void clear();
INLINE operator bool () const;
INLINE bool is_empty() const;
INLINE bool was_deleted() const;
@ -61,6 +64,8 @@ public:
private:
WPT(NodePathComponent) _head;
mutable int _backup_key;
friend class NodePath;
};
INLINE ostream &operator << (ostream &out, const WeakNodePath &node_path);