/** * 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 threadSafePointerTo.I * @author drose * @date 2006-04-28 */ /** * */ template INLINE ThreadSafePointerTo:: ThreadSafePointerTo(To *ptr) : ThreadSafePointerToBase(ptr) { } /** * */ template INLINE ThreadSafePointerTo:: ThreadSafePointerTo(const ThreadSafePointerTo ©) : ThreadSafePointerToBase((const ThreadSafePointerToBase &)copy) { } /** * */ template INLINE ThreadSafePointerTo:: ~ThreadSafePointerTo() { } /** * */ template INLINE typename ThreadSafePointerTo::To &ThreadSafePointerTo:: operator *() const { return *((To *)AtomicAdjust::get_ptr(this->_void_ptr)); } /** * */ template INLINE typename ThreadSafePointerTo::To *ThreadSafePointerTo:: operator -> () const { return (To *)AtomicAdjust::get_ptr(this->_void_ptr); } /** * We also have the typecast operator to automatically convert * ThreadSafePointerTo'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 ThreadSafePointerTo:: operator T * () const { return (To *)AtomicAdjust::get_ptr(this->_void_ptr); } /** * Returns an ordinary pointer instead of a ThreadSafePointerTo. Useful to * work around compiler problems, particularly for implicit upcasts. */ template INLINE typename ThreadSafePointerTo::To *ThreadSafePointerTo:: p() const { return (To *)AtomicAdjust::get_ptr(this->_void_ptr); } /** * */ template INLINE ThreadSafePointerTo &ThreadSafePointerTo:: operator = (To *ptr) { this->reassign(ptr); return *this; } /** * */ template INLINE ThreadSafePointerTo &ThreadSafePointerTo:: operator = (const ThreadSafePointerTo ©) { this->reassign((const ThreadSafePointerToBase &)copy); return *this; } /** * */ template INLINE ThreadSafeConstPointerTo:: ThreadSafeConstPointerTo(const typename ThreadSafeConstPointerTo::To *ptr) : ThreadSafePointerToBase((typename ThreadSafeConstPointerTo::To *)ptr) { } /** * */ template INLINE ThreadSafeConstPointerTo:: ThreadSafeConstPointerTo(const ThreadSafePointerTo ©) : ThreadSafePointerToBase((const ThreadSafePointerToBase &)copy) { } /** * */ template INLINE ThreadSafeConstPointerTo:: ~ThreadSafeConstPointerTo() { } /** * */ template INLINE ThreadSafeConstPointerTo:: ThreadSafeConstPointerTo(const ThreadSafeConstPointerTo ©) : ThreadSafePointerToBase((const ThreadSafePointerToBase &)copy) { } /** * */ template INLINE const typename ThreadSafeConstPointerTo::To &ThreadSafeConstPointerTo:: operator *() const { return *((To *)AtomicAdjust::get_ptr(this->_void_ptr)); } /** * */ template INLINE const typename ThreadSafeConstPointerTo::To *ThreadSafeConstPointerTo:: operator -> () const { return (To *)AtomicAdjust::get_ptr(this->_void_ptr); } /** * We also have the typecast operator to automatically convert * ThreadSafeConstPointerTo'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 ThreadSafeConstPointerTo:: operator const T * () const { return (To *)AtomicAdjust::get_ptr(this->_void_ptr); } /** * Returns an ordinary pointer instead of a ThreadSafeConstPointerTo. Useful * to work around compiler problems, particularly for implicit upcasts. */ template INLINE const typename ThreadSafeConstPointerTo::To *ThreadSafeConstPointerTo:: p() const { return (To *)AtomicAdjust::get_ptr(this->_void_ptr); } /** * */ template INLINE ThreadSafeConstPointerTo &ThreadSafeConstPointerTo:: operator = (const To *ptr) { this->reassign((To *)ptr); return *this; } /** * */ template INLINE ThreadSafeConstPointerTo &ThreadSafeConstPointerTo:: operator = (const ThreadSafePointerTo ©) { this->reassign((const ThreadSafePointerToBase &)copy); return *this; } /** * */ template INLINE ThreadSafeConstPointerTo &ThreadSafeConstPointerTo:: operator = (const ThreadSafeConstPointerTo ©) { this->reassign((const ThreadSafePointerToBase &)copy); return *this; }