files have been moved to express

This commit is contained in:
David Rose 2006-05-15 17:34:29 +00:00
parent b75f89438f
commit 4b8d78f3c3
6 changed files with 0 additions and 583 deletions

View File

@ -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<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> &copy) :
NodePointerToBase<T>((const NodePointerToBase<T> &)copy)
{
}
////////////////////////////////////////////////////////////////////
// Function: NodePointerTo::Destructor
// Access: Public
// Description:
////////////////////////////////////////////////////////////////////
template<class T>
INLINE NodePointerTo<T>::
~NodePointerTo() {
}
////////////////////////////////////////////////////////////////////
// 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> &copy) {
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> &copy) :
NodePointerToBase<T>((const NodePointerToBase<T> &)copy)
{
}
////////////////////////////////////////////////////////////////////
// Function: NodeConstPointerTo::Copy Constructor
// Access: Public
// Description:
////////////////////////////////////////////////////////////////////
template<class T>
INLINE NodeConstPointerTo<T>::
NodeConstPointerTo(const NodeConstPointerTo<T> &copy) :
NodePointerToBase<T>((const NodePointerToBase<T> &)copy)
{
}
////////////////////////////////////////////////////////////////////
// Function: NodeConstPointerTo::Destructor
// Access: Public
// Description:
////////////////////////////////////////////////////////////////////
template<class T>
INLINE NodeConstPointerTo<T>::
~NodeConstPointerTo() {
}
////////////////////////////////////////////////////////////////////
// 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> &copy) {
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> &copy) {
reassign((const NodePointerToBase<T> &)copy);
return *this;
}

View File

@ -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"

View File

@ -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 T>
class NodePointerTo : public NodePointerToBase<T> {
public:
typedef TYPENAME NodePointerToBase<T>::To To;
INLINE NodePointerTo(To *ptr = (To *)NULL);
INLINE NodePointerTo(const NodePointerTo<T> &copy);
INLINE ~NodePointerTo();
INLINE To &operator *() const;
INLINE To *operator -> () const;
INLINE operator TYPENAME NodePointerToBase<T>::To *() const;
INLINE To *p() const;
INLINE NodePointerTo<T> &operator = (To *ptr);
INLINE NodePointerTo<T> &operator = (const NodePointerTo<T> &copy);
};
////////////////////////////////////////////////////////////////////
// Class : NodeConstPointerTo
// Description : A NodeConstPointerTo is similar to a NodePointerTo,
// except it keeps a const pointer to the thing.
////////////////////////////////////////////////////////////////////
template <class T>
class NodeConstPointerTo : public NodePointerToBase<T> {
public:
typedef TYPENAME NodePointerToBase<T>::To To;
INLINE NodeConstPointerTo(const To *ptr = (const To *)NULL);
INLINE NodeConstPointerTo(const NodePointerTo<T> &copy);
INLINE NodeConstPointerTo(const NodeConstPointerTo<T> &copy);
INLINE ~NodeConstPointerTo();
INLINE const To &operator *() const;
INLINE const To *operator -> () const;
INLINE operator const TYPENAME NodePointerToBase<T>::To *() const;
INLINE const To *p() const;
INLINE NodeConstPointerTo<T> &operator = (const To *ptr);
INLINE NodeConstPointerTo<T> &operator = (const NodePointerTo<T> &copy);
INLINE NodeConstPointerTo<T> &operator = (const NodeConstPointerTo<T> &copy);
};
#define NPT(type) NodePointerTo< type >
#define NCPT(type) NodeConstPointerTo< type >
#include "nodePointerTo.I"
#endif

View File

@ -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<class T>
INLINE NodePointerToBase<T>::
NodePointerToBase(To *ptr) {
reassign(ptr);
}
////////////////////////////////////////////////////////////////////
// Function: NodePointerToBase::Copy Constructor
// Access: Protected
// Description:
////////////////////////////////////////////////////////////////////
template<class T>
INLINE NodePointerToBase<T>::
NodePointerToBase(const NodePointerToBase<T> &copy) {
reassign(copy);
}
////////////////////////////////////////////////////////////////////
// Function: NodePointerToBase::Destructor
// Access: Protected
// Description:
////////////////////////////////////////////////////////////////////
template<class T>
INLINE NodePointerToBase<T>::
~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<class T>
void NodePointerToBase<T>::
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<class T>
INLINE void NodePointerToBase<T>::
reassign(const NodePointerToBase<To> &copy) {
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<class T>
INLINE void NodePointerToBase<T>::
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<class T>
INLINE void NodePointerToBase<T>::
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();
}
}

View File

@ -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"

View File

@ -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 T>
class NodePointerToBase : public PointerToVoid {
public:
typedef T To;
protected:
INLINE NodePointerToBase(To *ptr);
INLINE NodePointerToBase(const NodePointerToBase<T> &copy);
INLINE ~NodePointerToBase();
void reassign(To *ptr);
INLINE void reassign(const NodePointerToBase<To> &copy);
// 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<class T>
INLINE ostream &operator <<(ostream &out, const NodePointerToBase<T> &pointer) {
pointer.output(out);
return out;
}
#include "nodePointerToBase.I"
#endif