From 4b8d78f3c38dc756c69e2ea6bdddf5f19a76b060 Mon Sep 17 00:00:00 2001 From: David Rose Date: Mon, 15 May 2006 17:34:29 +0000 Subject: [PATCH] files have been moved to express --- panda/src/putil/nodePointerTo.I | 259 -------------------------- panda/src/putil/nodePointerTo.cxx | 19 -- panda/src/putil/nodePointerTo.h | 81 -------- panda/src/putil/nodePointerToBase.I | 135 -------------- panda/src/putil/nodePointerToBase.cxx | 19 -- panda/src/putil/nodePointerToBase.h | 70 ------- 6 files changed, 583 deletions(-) delete mode 100644 panda/src/putil/nodePointerTo.I delete mode 100644 panda/src/putil/nodePointerTo.cxx delete mode 100644 panda/src/putil/nodePointerTo.h delete mode 100644 panda/src/putil/nodePointerToBase.I delete mode 100644 panda/src/putil/nodePointerToBase.cxx delete mode 100644 panda/src/putil/nodePointerToBase.h diff --git a/panda/src/putil/nodePointerTo.I b/panda/src/putil/nodePointerTo.I deleted file mode 100644 index da103e59f2..0000000000 --- a/panda/src/putil/nodePointerTo.I +++ /dev/null @@ -1,259 +0,0 @@ -// 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 -// panda3d-general@lists.sourceforge.net . -// -//////////////////////////////////////////////////////////////////// - - -//////////////////////////////////////////////////////////////////// -// Function: NodePointerTo::Constructor -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -template -INLINE NodePointerTo:: -NodePointerTo(To *ptr) : NodePointerToBase(ptr) { -} - -//////////////////////////////////////////////////////////////////// -// Function: NodePointerTo::Copy Constructor -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -template -INLINE NodePointerTo:: -NodePointerTo(const NodePointerTo ©) : - NodePointerToBase((const NodePointerToBase &)copy) -{ -} - -//////////////////////////////////////////////////////////////////// -// Function: NodePointerTo::Destructor -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -template -INLINE NodePointerTo:: -~NodePointerTo() { -} - -//////////////////////////////////////////////////////////////////// -// Function: NodePointerTo::Dereference operator -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -template -INLINE TYPENAME NodePointerTo::To &NodePointerTo:: -operator *() const { - return *((To *)(this->_void_ptr)); -} - -//////////////////////////////////////////////////////////////////// -// Function: NodePointerTo::Member access operator -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -template -INLINE TYPENAME NodePointerTo::To *NodePointerTo:: -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 -INLINE NodePointerTo:: -operator TYPENAME NodePointerToBase::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 -INLINE TYPENAME NodePointerTo::To *NodePointerTo:: -p() const { - return (To *)(this->_void_ptr); -} - -//////////////////////////////////////////////////////////////////// -// Function: NodePointerTo::Assignment operator -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -template -INLINE NodePointerTo &NodePointerTo:: -operator = (To *ptr) { - reassign(ptr); - return *this; -} - -//////////////////////////////////////////////////////////////////// -// Function: NodePointerTo::Assignment operator -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -template -INLINE NodePointerTo &NodePointerTo:: -operator = (const NodePointerTo ©) { - reassign((const NodePointerToBase &)copy); - return *this; -} - -//////////////////////////////////////////////////////////////////// -// Function: NodeConstPointerTo::Constructor -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -template -INLINE NodeConstPointerTo:: -NodeConstPointerTo(const TYPENAME NodeConstPointerTo::To *ptr) : - NodePointerToBase((TYPENAME NodeConstPointerTo::To *)ptr) -{ -} - -//////////////////////////////////////////////////////////////////// -// Function: NodeConstPointerTo::Copy Constructor -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -template -INLINE NodeConstPointerTo:: -NodeConstPointerTo(const NodePointerTo ©) : - NodePointerToBase((const NodePointerToBase &)copy) -{ -} - -//////////////////////////////////////////////////////////////////// -// Function: NodeConstPointerTo::Copy Constructor -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -template -INLINE NodeConstPointerTo:: -NodeConstPointerTo(const NodeConstPointerTo ©) : - NodePointerToBase((const NodePointerToBase &)copy) -{ -} - -//////////////////////////////////////////////////////////////////// -// Function: NodeConstPointerTo::Destructor -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -template -INLINE NodeConstPointerTo:: -~NodeConstPointerTo() { -} - -//////////////////////////////////////////////////////////////////// -// Function: NodeConstPointerTo::Dereference operator -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -template -INLINE const TYPENAME NodeConstPointerTo::To &NodeConstPointerTo:: -operator *() const { - return *((To *)(this->_void_ptr)); -} - -//////////////////////////////////////////////////////////////////// -// Function: NodeConstPointerTo::Member access operator -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -template -INLINE const TYPENAME NodeConstPointerTo::To *NodeConstPointerTo:: -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 -INLINE NodeConstPointerTo:: -operator const TYPENAME NodePointerToBase::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 -INLINE const TYPENAME NodeConstPointerTo::To *NodeConstPointerTo:: -p() const { - return (To *)(this->_void_ptr); -} - -//////////////////////////////////////////////////////////////////// -// Function: NodeConstPointerTo::Assignment operator -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -template -INLINE NodeConstPointerTo &NodeConstPointerTo:: -operator = (const To *ptr) { - reassign((To *)ptr); - return *this; -} - -//////////////////////////////////////////////////////////////////// -// Function: NodeConstPointerTo::Assignment operator -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -template -INLINE NodeConstPointerTo &NodeConstPointerTo:: -operator = (const NodePointerTo ©) { - reassign((const NodePointerToBase &)copy); - return *this; -} - -//////////////////////////////////////////////////////////////////// -// Function: NodeConstPointerTo::Assignment operator -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -template -INLINE NodeConstPointerTo &NodeConstPointerTo:: -operator = (const NodeConstPointerTo ©) { - reassign((const NodePointerToBase &)copy); - return *this; -} diff --git a/panda/src/putil/nodePointerTo.cxx b/panda/src/putil/nodePointerTo.cxx deleted file mode 100644 index 541a45cb96..0000000000 --- a/panda/src/putil/nodePointerTo.cxx +++ /dev/null @@ -1,19 +0,0 @@ -// Filename: nodePointerTo.cxx -// 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 -// panda3d-general@lists.sourceforge.net . -// -//////////////////////////////////////////////////////////////////// - -#include "nodePointerTo.h" diff --git a/panda/src/putil/nodePointerTo.h b/panda/src/putil/nodePointerTo.h deleted file mode 100644 index aa1e7fb4d3..0000000000 --- a/panda/src/putil/nodePointerTo.h +++ /dev/null @@ -1,81 +0,0 @@ -// Filename: nodePointerTo.h -// 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 -// panda3d-general@lists.sourceforge.net . -// -//////////////////////////////////////////////////////////////////// - -#ifndef NODEPOINTERTO_H -#define NODEPOINTERTO_H - -#include "pandabase.h" -#include "nodePointerToBase.h" - -//////////////////////////////////////////////////////////////////// -// Class : NodePointerTo -// Description : 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: - typedef TYPENAME NodePointerToBase::To To; - INLINE NodePointerTo(To *ptr = (To *)NULL); - INLINE NodePointerTo(const NodePointerTo ©); - INLINE ~NodePointerTo(); - - INLINE To &operator *() const; - INLINE To *operator -> () const; - INLINE operator TYPENAME NodePointerToBase::To *() const; - - INLINE To *p() const; - - INLINE NodePointerTo &operator = (To *ptr); - INLINE NodePointerTo &operator = (const NodePointerTo ©); -}; - - -//////////////////////////////////////////////////////////////////// -// Class : NodeConstPointerTo -// Description : A NodeConstPointerTo is similar to a NodePointerTo, -// except it keeps a const pointer to the thing. -//////////////////////////////////////////////////////////////////// -template -class NodeConstPointerTo : public NodePointerToBase { -public: - typedef TYPENAME NodePointerToBase::To To; - INLINE NodeConstPointerTo(const To *ptr = (const To *)NULL); - INLINE NodeConstPointerTo(const NodePointerTo ©); - INLINE NodeConstPointerTo(const NodeConstPointerTo ©); - INLINE ~NodeConstPointerTo(); - - INLINE const To &operator *() const; - INLINE const To *operator -> () const; - INLINE operator const TYPENAME NodePointerToBase::To *() const; - - INLINE const To *p() const; - - INLINE NodeConstPointerTo &operator = (const To *ptr); - INLINE NodeConstPointerTo &operator = (const NodePointerTo ©); - INLINE NodeConstPointerTo &operator = (const NodeConstPointerTo ©); -}; - -#define NPT(type) NodePointerTo< type > -#define NCPT(type) NodeConstPointerTo< type > - -#include "nodePointerTo.I" - -#endif diff --git a/panda/src/putil/nodePointerToBase.I b/panda/src/putil/nodePointerToBase.I deleted file mode 100644 index 8c7dd89147..0000000000 --- a/panda/src/putil/nodePointerToBase.I +++ /dev/null @@ -1,135 +0,0 @@ -// Filename: nodePointerToBase.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 -// panda3d-general@lists.sourceforge.net . -// -//////////////////////////////////////////////////////////////////// - - -//////////////////////////////////////////////////////////////////// -// Function: NodePointerToBase::Constructor -// Access: Protected -// Description: -//////////////////////////////////////////////////////////////////// -template -INLINE NodePointerToBase:: -NodePointerToBase(To *ptr) { - reassign(ptr); -} - -//////////////////////////////////////////////////////////////////// -// Function: NodePointerToBase::Copy Constructor -// Access: Protected -// Description: -//////////////////////////////////////////////////////////////////// -template -INLINE NodePointerToBase:: -NodePointerToBase(const NodePointerToBase ©) { - reassign(copy); -} - -//////////////////////////////////////////////////////////////////// -// Function: NodePointerToBase::Destructor -// Access: Protected -// Description: -//////////////////////////////////////////////////////////////////// -template -INLINE NodePointerToBase:: -~NodePointerToBase() { - reassign((To *)NULL); -} - -//////////////////////////////////////////////////////////////////// -// Function: NodePointerToBase::reassign -// Access: Protected -// Description: This is the main work of the NodePointerTo family. When -// the pointer is reassigned, decrement the old -// reference count and increment the new one. -//////////////////////////////////////////////////////////////////// -template -void NodePointerToBase:: -reassign(To *ptr) { - if (ptr != (To *)_void_ptr) { - // First save the old pointer; we won't delete it until we have - // assigned the new one. We do this just in case there are - // cascading effects from deleting this pointer that might - // inadvertently delete the new one. (Don't laugh--it's - // happened!) - To *old_ptr = (To *)_void_ptr; - - _void_ptr = (void *)ptr; - if (ptr != (To *)NULL) { - ptr->node_ref(); -#ifdef DO_MEMORY_USAGE - if (MemoryUsage::get_track_memory_usage()) { - // Make sure the MemoryUsage record knows what the TypeHandle - // is, if we know it ourselves. - TypeHandle type = get_type_handle(To); - if (type == TypeHandle::none()) { - do_init_type(To); - type = get_type_handle(To); - } - if (type != TypeHandle::none()) { - MemoryUsage::update_type(ptr, type); - } - } -#endif - } - - // Now delete the old pointer. - if (old_ptr != (To *)NULL) { - node_unref_delete(old_ptr); - } - } -} - -//////////////////////////////////////////////////////////////////// -// Function: NodePointerToBase::reassign -// Access: Protected -// Description: -//////////////////////////////////////////////////////////////////// -template -INLINE void NodePointerToBase:: -reassign(const NodePointerToBase ©) { - reassign((To *)copy._void_ptr); -} - - -//////////////////////////////////////////////////////////////////// -// Function: NodePointerToBase::clear -// Access: Published -// Description: A convenient way to set the NodePointerTo object to NULL. -// (Assignment to a NULL pointer also works, of course.) -//////////////////////////////////////////////////////////////////// -template -INLINE void NodePointerToBase:: -clear() { - reassign((To *)NULL); -} - -//////////////////////////////////////////////////////////////////// -// Function: NodePointerToBase::output -// Access: Published -// Description: A handy function to output NodePointerTo's as a hex -// pointer followed by a reference count. -//////////////////////////////////////////////////////////////////// -template -INLINE void NodePointerToBase:: -output(ostream &out) const { - out << _void_ptr; - if (_void_ptr != (void *)NULL) { - out << ":" << ((To *)_void_ptr)->get_node_ref_count() << "/" - << ((To *)_void_ptr)->get_ref_count(); - } -} diff --git a/panda/src/putil/nodePointerToBase.cxx b/panda/src/putil/nodePointerToBase.cxx deleted file mode 100644 index ea382868eb..0000000000 --- a/panda/src/putil/nodePointerToBase.cxx +++ /dev/null @@ -1,19 +0,0 @@ -// Filename: nodePointerToBase.cxx -// 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 -// panda3d-general@lists.sourceforge.net . -// -//////////////////////////////////////////////////////////////////// - -#include "nodePointerToBase.h" diff --git a/panda/src/putil/nodePointerToBase.h b/panda/src/putil/nodePointerToBase.h deleted file mode 100644 index 5212647912..0000000000 --- a/panda/src/putil/nodePointerToBase.h +++ /dev/null @@ -1,70 +0,0 @@ -// Filename: nodePointerToBase.h -// 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 -// panda3d-general@lists.sourceforge.net . -// -//////////////////////////////////////////////////////////////////// - -#ifndef NODEPOINTERTOBASE_H -#define NODEPOINTERTOBASE_H - -#include "pandabase.h" -#include "pointerToVoid.h" -#include "nodeCachedReferenceCount.h" -#include "memoryUsage.h" -#include "config_express.h" - -//////////////////////////////////////////////////////////////////// -// Class : NodePointerToBase -// Description : This is similar to PointerToBase, but it manages -// objects of type NodeCachedReferenceCount, and it -// updates the node_ref_count instead of the regular -// ref_count. It is intended for use only in PandaNode, -// to hold a pointer to RenderState and TransformState, -// although it could be used by any object that wanted -// to maintain a separate reference count for reporting -// purposes. -//////////////////////////////////////////////////////////////////// -template -class NodePointerToBase : public PointerToVoid { -public: - typedef T To; - -protected: - INLINE NodePointerToBase(To *ptr); - INLINE NodePointerToBase(const NodePointerToBase ©); - INLINE ~NodePointerToBase(); - - void reassign(To *ptr); - INLINE void reassign(const NodePointerToBase ©); - - // No assignment or retrieval functions are declared in - // NodePointerToBase, because we will have to specialize on const - // vs. non-const later. - -PUBLISHED: - INLINE void clear(); - - void output(ostream &out) const; -}; - -template -INLINE ostream &operator <<(ostream &out, const NodePointerToBase &pointer) { - pointer.output(out); - return out; -} - -#include "nodePointerToBase.I" - -#endif