// Filename: nodePointerTo.I // Created by: drose (07May05) // //////////////////////////////////////////////////////////////////// // // 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." // //////////////////////////////////////////////////////////////////// #ifndef CPPPARSER //////////////////////////////////////////////////////////////////// // Function: NodePointerTo::Constructor // Access: Public // Description: //////////////////////////////////////////////////////////////////// template INLINE NodePointerTo:: NodePointerTo(To *ptr) : NodePointerToBase(ptr) { } #endif // CPPPARSER #ifndef CPPPARSER //////////////////////////////////////////////////////////////////// // Function: NodePointerTo::Copy Constructor // Access: Public // Description: //////////////////////////////////////////////////////////////////// template INLINE NodePointerTo:: NodePointerTo(const NodePointerTo ©) : NodePointerToBase((const NodePointerToBase &)copy) { } #endif // CPPPARSER #ifndef CPPPARSER //////////////////////////////////////////////////////////////////// // Function: NodePointerTo::Destructor // Access: Public // Description: //////////////////////////////////////////////////////////////////// template INLINE NodePointerTo:: ~NodePointerTo() { } #endif // CPPPARSER #ifndef CPPPARSER //////////////////////////////////////////////////////////////////// // Function: NodePointerTo::Dereference operator // Access: Public // Description: //////////////////////////////////////////////////////////////////// template INLINE TYPENAME NodePointerTo::To &NodePointerTo:: operator *() const { return *((To *)(this->_void_ptr)); } #endif // CPPPARSER #ifndef CPPPARSER //////////////////////////////////////////////////////////////////// // Function: NodePointerTo::Member access operator // Access: Public // Description: //////////////////////////////////////////////////////////////////// template INLINE TYPENAME NodePointerTo::To *NodePointerTo:: operator -> () const { return (To *)(this->_void_ptr); } #endif // CPPPARSER #ifndef CPPPARSER //////////////////////////////////////////////////////////////////// // Function: NodePointerTo::Typecast operator // Access: Public // Description: We also have the typecast operator to automatically // convert NodePointerTo's to the required kind of actual // pointer. This introduces ambiguities which the // compiler will resolve one way or the other, but we // don't care which way it goes because either will be // correct. //////////////////////////////////////////////////////////////////// template INLINE NodePointerTo:: operator T *() const { return (To *)(this->_void_ptr); } #endif // CPPPARSER #ifndef CPPPARSER //////////////////////////////////////////////////////////////////// // Function: NodePointerTo::p // Access: Public // Description: Returns an ordinary pointer instead of a NodePointerTo. // Useful to work around compiler problems, particularly // for implicit upcasts. //////////////////////////////////////////////////////////////////// template INLINE TYPENAME NodePointerTo::To *NodePointerTo:: p() const { return (To *)(this->_void_ptr); } #endif // CPPPARSER #ifndef CPPPARSER //////////////////////////////////////////////////////////////////// // Function: NodePointerTo::Assignment operator // Access: Public // Description: //////////////////////////////////////////////////////////////////// template INLINE NodePointerTo &NodePointerTo:: operator = (To *ptr) { reassign(ptr); return *this; } #endif // CPPPARSER #ifndef CPPPARSER //////////////////////////////////////////////////////////////////// // Function: NodePointerTo::Assignment operator // Access: Public // Description: //////////////////////////////////////////////////////////////////// template INLINE NodePointerTo &NodePointerTo:: operator = (const NodePointerTo ©) { reassign((const NodePointerToBase &)copy); return *this; } #endif // CPPPARSER #ifndef CPPPARSER //////////////////////////////////////////////////////////////////// // Function: NodeConstPointerTo::Constructor // Access: Public // Description: //////////////////////////////////////////////////////////////////// template INLINE NodeConstPointerTo:: NodeConstPointerTo(const TYPENAME NodeConstPointerTo::To *ptr) : NodePointerToBase((TYPENAME NodeConstPointerTo::To *)ptr) { } #endif // CPPPARSER #ifndef CPPPARSER //////////////////////////////////////////////////////////////////// // Function: NodeConstPointerTo::Copy Constructor // Access: Public // Description: //////////////////////////////////////////////////////////////////// template INLINE NodeConstPointerTo:: NodeConstPointerTo(const NodePointerTo ©) : NodePointerToBase((const NodePointerToBase &)copy) { } #endif // CPPPARSER #ifndef CPPPARSER //////////////////////////////////////////////////////////////////// // Function: NodeConstPointerTo::Copy Constructor // Access: Public // Description: //////////////////////////////////////////////////////////////////// template INLINE NodeConstPointerTo:: NodeConstPointerTo(const NodeConstPointerTo ©) : NodePointerToBase((const NodePointerToBase &)copy) { } #endif // CPPPARSER #ifndef CPPPARSER //////////////////////////////////////////////////////////////////// // Function: NodeConstPointerTo::Destructor // Access: Public // Description: //////////////////////////////////////////////////////////////////// template INLINE NodeConstPointerTo:: ~NodeConstPointerTo() { } #endif // CPPPARSER #ifndef CPPPARSER //////////////////////////////////////////////////////////////////// // Function: NodeConstPointerTo::Dereference operator // Access: Public // Description: //////////////////////////////////////////////////////////////////// template INLINE const TYPENAME NodeConstPointerTo::To &NodeConstPointerTo:: operator *() const { return *((To *)(this->_void_ptr)); } #endif // CPPPARSER #ifndef CPPPARSER //////////////////////////////////////////////////////////////////// // Function: NodeConstPointerTo::Member access operator // Access: Public // Description: //////////////////////////////////////////////////////////////////// template INLINE const TYPENAME NodeConstPointerTo::To *NodeConstPointerTo:: operator -> () const { return (To *)(this->_void_ptr); } #endif // CPPPARSER #ifndef CPPPARSER //////////////////////////////////////////////////////////////////// // Function: NodeConstPointerTo::Typecast operator // Access: Public // Description: We also have the typecast operator to automatically // convert NodeConstPointerTo's to the required kind of actual // pointer. This introduces ambiguities which the // compiler will resolve one way or the other, but we // don't care which way it goes because either will be // correct. //////////////////////////////////////////////////////////////////// template INLINE NodeConstPointerTo:: operator const T * () const { return (To *)(this->_void_ptr); } #endif // CPPPARSER #ifndef CPPPARSER //////////////////////////////////////////////////////////////////// // Function: NodeConstPointerTo::p // Access: Public // Description: Returns an ordinary pointer instead of a NodeConstPointerTo. // Useful to work around compiler problems, particularly // for implicit upcasts. //////////////////////////////////////////////////////////////////// template INLINE const TYPENAME NodeConstPointerTo::To *NodeConstPointerTo:: p() const { return (To *)(this->_void_ptr); } #endif // CPPPARSER #ifndef CPPPARSER //////////////////////////////////////////////////////////////////// // Function: NodeConstPointerTo::Assignment operator // Access: Public // Description: //////////////////////////////////////////////////////////////////// template INLINE NodeConstPointerTo &NodeConstPointerTo:: operator = (const To *ptr) { reassign((To *)ptr); return *this; } #endif // CPPPARSER #ifndef CPPPARSER //////////////////////////////////////////////////////////////////// // Function: NodeConstPointerTo::Assignment operator // Access: Public // Description: //////////////////////////////////////////////////////////////////// template INLINE NodeConstPointerTo &NodeConstPointerTo:: operator = (const NodePointerTo ©) { reassign((const NodePointerToBase &)copy); return *this; } #endif // CPPPARSER #ifndef CPPPARSER //////////////////////////////////////////////////////////////////// // Function: NodeConstPointerTo::Assignment operator // Access: Public // Description: //////////////////////////////////////////////////////////////////// template INLINE NodeConstPointerTo &NodeConstPointerTo:: operator = (const NodeConstPointerTo ©) { reassign((const NodePointerToBase &)copy); return *this; } #endif // CPPPARSER