/** * 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 nodePointerTo.h * @author drose * @date 2005-05-07 */ #ifndef NODEPOINTERTO_H #define NODEPOINTERTO_H #include "pandabase.h" #include "nodePointerToBase.h" /** * This implements the special NodePointerTo template class, which works just * like PointerTo except it manages the objects node_ref_count instead of the * normal ref_count. */ template class NodePointerTo : public NodePointerToBase { public: // By hiding this template from interrogate, we improve compile-time speed // and memory utilization. #ifndef CPPPARSER typedef typename NodePointerToBase::To To; INLINE NodePointerTo(To *ptr = nullptr); INLINE NodePointerTo(const NodePointerTo ©); INLINE NodePointerTo(NodePointerTo &&from) noexcept; INLINE NodePointerTo &operator = (NodePointerTo &&from) noexcept; INLINE To &operator *() const; INLINE To *operator -> () const; // MSVC.NET 2005 insists that we use T *, and not To *, here. INLINE operator T *() const; INLINE To *p() const; INLINE NodePointerTo &operator = (To *ptr); INLINE NodePointerTo &operator = (const NodePointerTo ©); #endif // CPPPARSER }; /** * A NodeConstPointerTo is similar to a NodePointerTo, except it keeps a const * pointer to the thing. */ template class NodeConstPointerTo : public NodePointerToBase { public: // By hiding this template from interrogate, we improve compile-time speed // and memory utilization. #ifndef CPPPARSER typedef typename NodePointerToBase::To To; INLINE NodeConstPointerTo(const To *ptr = nullptr); INLINE NodeConstPointerTo(const NodePointerTo ©); INLINE NodeConstPointerTo(const NodeConstPointerTo ©); INLINE NodeConstPointerTo(NodePointerTo &&from) noexcept; INLINE NodeConstPointerTo(NodeConstPointerTo &&from) noexcept; INLINE NodeConstPointerTo &operator = (NodePointerTo &&from) noexcept; INLINE NodeConstPointerTo &operator = (NodeConstPointerTo &&from) noexcept; INLINE const To &operator *() const; INLINE const To *operator -> () const; INLINE operator const T *() const; INLINE const To *p() const; INLINE NodeConstPointerTo &operator = (const To *ptr); INLINE NodeConstPointerTo &operator = (const NodePointerTo ©); INLINE NodeConstPointerTo &operator = (const NodeConstPointerTo ©); #endif // CPPPARSER }; template void swap(NodePointerTo &one, NodePointerTo &two) noexcept { one.swap(two); } template void swap(NodeConstPointerTo &one, NodeConstPointerTo &two) noexcept { one.swap(two); } #define NPT(type) NodePointerTo< type > #define NCPT(type) NodeConstPointerTo< type > #include "nodePointerTo.I" #endif