Panda3D

nodeReferenceCount.cxx

00001 // Filename: nodeReferenceCount.cxx
00002 // Created by:  drose (01May06)
00003 //
00004 ////////////////////////////////////////////////////////////////////
00005 //
00006 // PANDA 3D SOFTWARE
00007 // Copyright (c) Carnegie Mellon University.  All rights reserved.
00008 //
00009 // All use of this software is subject to the terms of the revised BSD
00010 // license.  You should have received a copy of this license along
00011 // with this source code in a file named "LICENSE."
00012 //
00013 ////////////////////////////////////////////////////////////////////
00014 
00015 #include "nodeReferenceCount.h"
00016 
00017 TypeHandle NodeReferenceCount::_type_handle;
00018 
00019 ////////////////////////////////////////////////////////////////////
00020 //     Function: NodeReferenceCount::do_test_ref_count_integrity
00021 //       Access: Protected
00022 //  Description: Does some easy checks to make sure that the reference
00023 //               count isn't completely bogus.
00024 ////////////////////////////////////////////////////////////////////
00025 bool NodeReferenceCount::
00026 do_test_ref_count_integrity() const {
00027   nassertr(this != NULL, false);
00028 
00029   // If this assertion fails, we're trying to delete an object that
00030   // was just deleted.  Possibly you used a real pointer instead of a
00031   // PointerTo at some point, and the object was deleted when the
00032   // PointerTo went out of scope.  Maybe you tried to create an
00033   // automatic (local variable) instance of a class that derives from
00034   // ReferenceCount.  Or maybe your headers are out of sync, and you
00035   // need to make clean in direct or some higher tree.
00036   nassertr(_node_ref_count != -100, false);
00037 
00038   // If this assertion fails, the reference counts are all screwed
00039   // up altogether.  Maybe some errant code stomped all over memory
00040   // somewhere.
00041   nassertr(_node_ref_count >= 0, false);
00042 
00043   return ReferenceCount::do_test_ref_count_integrity();
00044 }
 All Classes Functions Variables Enumerations