| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239 |
- // Filename: nodePointerTo.I
- // Created by: drose (07May05)
- //
- ////////////////////////////////////////////////////////////////////
- //
- // PANDA 3D SOFTWARE
- // Copyright (c) 2001 - 2004, Disney Enterprises, Inc. All rights reserved
- //
- // All use of this software is subject to the terms of the Panda 3d
- // Software license. You should have received a copy of this license
- // along with this source code; you will also find a current copy of
- // the license at http://etc.cmu.edu/panda3d/docs/license/ .
- //
- // To contact the maintainers of this program write to
- // [email protected] .
- //
- ////////////////////////////////////////////////////////////////////
- ////////////////////////////////////////////////////////////////////
- // Function: NodePointerTo::Constructor
- // Access: Public
- // Description:
- ////////////////////////////////////////////////////////////////////
- template<class T>
- INLINE NodePointerTo<T>::
- NodePointerTo(To *ptr) : NodePointerToBase<T>(ptr) {
- }
- ////////////////////////////////////////////////////////////////////
- // Function: NodePointerTo::Copy Constructor
- // Access: Public
- // Description:
- ////////////////////////////////////////////////////////////////////
- template<class T>
- INLINE NodePointerTo<T>::
- NodePointerTo(const NodePointerTo<T> ©) :
- NodePointerToBase<T>((const NodePointerToBase<T> &)copy)
- {
- }
- ////////////////////////////////////////////////////////////////////
- // Function: NodePointerTo::Dereference operator
- // Access: Public
- // Description:
- ////////////////////////////////////////////////////////////////////
- template<class T>
- INLINE TYPENAME NodePointerTo<T>::To &NodePointerTo<T>::
- operator *() const {
- return *((To *)(this->_void_ptr));
- }
- ////////////////////////////////////////////////////////////////////
- // Function: NodePointerTo::Member access operator
- // Access: Public
- // Description:
- ////////////////////////////////////////////////////////////////////
- template<class T>
- INLINE TYPENAME NodePointerTo<T>::To *NodePointerTo<T>::
- operator -> () const {
- return (To *)(this->_void_ptr);
- }
- ////////////////////////////////////////////////////////////////////
- // 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<class T>
- INLINE NodePointerTo<T>::
- operator TYPENAME NodePointerToBase<T>::To *() const {
- return (To *)(this->_void_ptr);
- }
- ////////////////////////////////////////////////////////////////////
- // 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<class T>
- INLINE TYPENAME NodePointerTo<T>::To *NodePointerTo<T>::
- p() const {
- return (To *)(this->_void_ptr);
- }
- ////////////////////////////////////////////////////////////////////
- // Function: NodePointerTo::Assignment operator
- // Access: Public
- // Description:
- ////////////////////////////////////////////////////////////////////
- template<class T>
- INLINE NodePointerTo<T> &NodePointerTo<T>::
- operator = (To *ptr) {
- reassign(ptr);
- return *this;
- }
- ////////////////////////////////////////////////////////////////////
- // Function: NodePointerTo::Assignment operator
- // Access: Public
- // Description:
- ////////////////////////////////////////////////////////////////////
- template<class T>
- INLINE NodePointerTo<T> &NodePointerTo<T>::
- operator = (const NodePointerTo<T> ©) {
- reassign((const NodePointerToBase<T> &)copy);
- return *this;
- }
- ////////////////////////////////////////////////////////////////////
- // Function: NodeConstPointerTo::Constructor
- // Access: Public
- // Description:
- ////////////////////////////////////////////////////////////////////
- template<class T>
- INLINE NodeConstPointerTo<T>::
- NodeConstPointerTo(const TYPENAME NodeConstPointerTo<T>::To *ptr) :
- NodePointerToBase<T>((TYPENAME NodeConstPointerTo<T>::To *)ptr)
- {
- }
- ////////////////////////////////////////////////////////////////////
- // Function: NodeConstPointerTo::Copy Constructor
- // Access: Public
- // Description:
- ////////////////////////////////////////////////////////////////////
- template<class T>
- INLINE NodeConstPointerTo<T>::
- NodeConstPointerTo(const NodePointerTo<T> ©) :
- NodePointerToBase<T>((const NodePointerToBase<T> &)copy)
- {
- }
- ////////////////////////////////////////////////////////////////////
- // Function: NodeConstPointerTo::Copy Constructor
- // Access: Public
- // Description:
- ////////////////////////////////////////////////////////////////////
- template<class T>
- INLINE NodeConstPointerTo<T>::
- NodeConstPointerTo(const NodeConstPointerTo<T> ©) :
- NodePointerToBase<T>((const NodePointerToBase<T> &)copy)
- {
- }
- ////////////////////////////////////////////////////////////////////
- // Function: NodeConstPointerTo::Dereference operator
- // Access: Public
- // Description:
- ////////////////////////////////////////////////////////////////////
- template<class T>
- INLINE const TYPENAME NodeConstPointerTo<T>::To &NodeConstPointerTo<T>::
- operator *() const {
- return *((To *)(this->_void_ptr));
- }
- ////////////////////////////////////////////////////////////////////
- // Function: NodeConstPointerTo::Member access operator
- // Access: Public
- // Description:
- ////////////////////////////////////////////////////////////////////
- template<class T>
- INLINE const TYPENAME NodeConstPointerTo<T>::To *NodeConstPointerTo<T>::
- operator -> () const {
- return (To *)(this->_void_ptr);
- }
- ////////////////////////////////////////////////////////////////////
- // 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<class T>
- INLINE NodeConstPointerTo<T>::
- operator const TYPENAME NodePointerToBase<T>::To *() const {
- return (To *)(this->_void_ptr);
- }
- ////////////////////////////////////////////////////////////////////
- // 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<class T>
- INLINE const TYPENAME NodeConstPointerTo<T>::To *NodeConstPointerTo<T>::
- p() const {
- return (To *)(this->_void_ptr);
- }
- ////////////////////////////////////////////////////////////////////
- // Function: NodeConstPointerTo::Assignment operator
- // Access: Public
- // Description:
- ////////////////////////////////////////////////////////////////////
- template<class T>
- INLINE NodeConstPointerTo<T> &NodeConstPointerTo<T>::
- operator = (const To *ptr) {
- reassign((To *)ptr);
- return *this;
- }
- ////////////////////////////////////////////////////////////////////
- // Function: NodeConstPointerTo::Assignment operator
- // Access: Public
- // Description:
- ////////////////////////////////////////////////////////////////////
- template<class T>
- INLINE NodeConstPointerTo<T> &NodeConstPointerTo<T>::
- operator = (const NodePointerTo<T> ©) {
- reassign((const NodePointerToBase<T> &)copy);
- return *this;
- }
- ////////////////////////////////////////////////////////////////////
- // Function: NodeConstPointerTo::Assignment operator
- // Access: Public
- // Description:
- ////////////////////////////////////////////////////////////////////
- template<class T>
- INLINE NodeConstPointerTo<T> &NodeConstPointerTo<T>::
- operator = (const NodeConstPointerTo<T> ©) {
- reassign((const NodePointerToBase<T> &)copy);
- return *this;
- }
|