Browse Source

Let's not name members "_object" since it confuses interrogate when parsing initialiser lists.

rdb 11 years ago
parent
commit
f805098a03

+ 20 - 20
panda/src/pgraph/pandaNode.I

@@ -1315,13 +1315,13 @@ get_parent(int n) const {
 //  Description:
 ////////////////////////////////////////////////////////////////////
 INLINE PandaNodePipelineReader::
-PandaNodePipelineReader(const PandaNode *object, Thread *current_thread) :
-  _object(object),
+PandaNodePipelineReader(const PandaNode *node, Thread *current_thread) :
+  _node(node),
   _current_thread(current_thread),
-  _cdata(object->_cycler.read_unlocked(current_thread))
+  _cdata(node->_cycler.read_unlocked(current_thread))
 {
 #ifdef _DEBUG
-  nassertv(_object->test_ref_count_nonzero());
+  nassertv(_node->test_ref_count_nonzero());
 #endif // _DEBUG
 
 #ifdef DO_PIPELINING
@@ -1335,11 +1335,11 @@ PandaNodePipelineReader(const PandaNode *object, Thread *current_thread) :
 ////////////////////////////////////////////////////////////////////
 //     Function: PandaNodePipelineReader::Copy Constructor
 //       Access: Public
-//  Description: 
+//  Description:
 ////////////////////////////////////////////////////////////////////
 INLINE PandaNodePipelineReader::
 PandaNodePipelineReader(const PandaNodePipelineReader &copy) :
-  _object(copy._object),
+  _node(copy._node),
   _current_thread(copy._current_thread),
   _cdata(copy._cdata)
 {
@@ -1349,7 +1349,7 @@ PandaNodePipelineReader(const PandaNodePipelineReader &copy) :
 
   /*
   if (_cdata != (PandaNode::CData *)NULL) {
-    _object->_cycler.increment_read(_cdata);
+    _node->_cycler.increment_read(_cdata);
   }
   */
 }
@@ -1357,7 +1357,7 @@ PandaNodePipelineReader(const PandaNodePipelineReader &copy) :
 ////////////////////////////////////////////////////////////////////
 //     Function: PandaNodePipelineReader::Copy Assignment Operator
 //       Access: Public
-//  Description: 
+//  Description:
 ////////////////////////////////////////////////////////////////////
 INLINE void PandaNodePipelineReader::
 operator = (const PandaNodePipelineReader &copy) {
@@ -1365,7 +1365,7 @@ operator = (const PandaNodePipelineReader &copy) {
 
   /*
   if (_cdata != (PandaNode::CData *)NULL) {
-    _object->_cycler.release_read(_cdata);
+    _node->_cycler.release_read(_cdata);
   }
   */
 
@@ -1373,7 +1373,7 @@ operator = (const PandaNodePipelineReader &copy) {
   node_unref_delete((CycleData *)_cdata);
 #endif  // DO_PIPELINING
 
-  _object = copy._object;
+  _node = copy._node;
   _cdata = copy._cdata;
 
 #ifdef DO_PIPELINING
@@ -1382,7 +1382,7 @@ operator = (const PandaNodePipelineReader &copy) {
 
   /*
   if (_cdata != (PandaNode::CData *)NULL) {
-    _object->_cycler.increment_read(_cdata);
+    _node->_cycler.increment_read(_cdata);
   }
   */
 }
@@ -1396,7 +1396,7 @@ INLINE PandaNodePipelineReader::
 ~PandaNodePipelineReader() {
   /*
   if (_cdata != (PandaNode::CData *)NULL) {
-    _object->_cycler.release_read(_cdata);
+    _node->_cycler.release_read(_cdata);
   }
   */
 
@@ -1405,19 +1405,19 @@ INLINE PandaNodePipelineReader::
 #endif  // DO_PIPELINING
 
 #ifdef _DEBUG
-  _object = NULL;
+  _node = NULL;
   _cdata = NULL;
 #endif  // _DEBUG
 }
 
 ////////////////////////////////////////////////////////////////////
-//     Function: PandaNodePipelineReader::get_object
+//     Function: PandaNodePipelineReader::get_node
 //       Access: Public
 //  Description:
 ////////////////////////////////////////////////////////////////////
 INLINE const PandaNode *PandaNodePipelineReader::
-get_object() const {
-  return _object;
+get_node() const {
+  return _node;
 }
 
 ////////////////////////////////////////////////////////////////////
@@ -1440,7 +1440,7 @@ INLINE void PandaNodePipelineReader::
 release() {
   /*
   if (_cdata != (PandaNode::CData *)NULL) {
-    _object->_cycler.release_read(_cdata);
+    _node->_cycler.release_read(_cdata);
     _cdata = NULL;
   }
   */
@@ -1539,7 +1539,7 @@ get_parent(int n) const {
 ////////////////////////////////////////////////////////////////////
 INLINE int PandaNodePipelineReader::
 find_parent(PandaNode *node) const {
-  return _object->do_find_parent(node, _cdata);
+  return _node->do_find_parent(node, _cdata);
 }
 
 ////////////////////////////////////////////////////////////////////
@@ -1592,7 +1592,7 @@ get_child_sort(int n) const {
 ////////////////////////////////////////////////////////////////////
 INLINE int PandaNodePipelineReader::
 find_child(PandaNode *node) const {
-  return _object->do_find_child(node, _cdata->get_down());
+  return _node->do_find_child(node, _cdata->get_down());
 }
 
 ////////////////////////////////////////////////////////////////////
@@ -1645,7 +1645,7 @@ get_stashed_sort(int n) const {
 ////////////////////////////////////////////////////////////////////
 INLINE int PandaNodePipelineReader::
 find_stashed(PandaNode *node) const {
-  return _object->do_find_child(node, _cdata->get_stashed());
+  return _node->do_find_child(node, _cdata->get_stashed());
 }
 
 ////////////////////////////////////////////////////////////////////

+ 2 - 2
panda/src/pgraph/pandaNode.cxx

@@ -4798,7 +4798,7 @@ check_bounds() const {
 #endif  // DO_PIPELINING
     ((PandaNodePipelineReader *)this)->_cdata = NULL;
     int pipeline_stage = _current_thread->get_pipeline_stage();
-    PandaNode::CDLockedStageReader fresh_cdata(_object->_cycler, pipeline_stage, _current_thread);
+    PandaNode::CDLockedStageReader fresh_cdata(_node->_cycler, pipeline_stage, _current_thread);
     if (fresh_cdata->_last_update == fresh_cdata->_next_update) {
       // What luck, some other thread has already freshened the
       // cache for us.  Save the new pointer, and let the lock
@@ -4814,7 +4814,7 @@ check_bounds() const {
       // No, the cache is still stale.  We have to do the work of
       // freshening it.
       PStatTimer timer(PandaNode::_update_bounds_pcollector);
-      PandaNode::CDStageWriter cdataw = ((PandaNode *)_object)->update_bounds(pipeline_stage, fresh_cdata);
+      PandaNode::CDStageWriter cdataw = ((PandaNode *)_node)->update_bounds(pipeline_stage, fresh_cdata);
       nassertv(cdataw->_last_update == cdataw->_next_update);
       // As above, we save the new pointer, and then let the lock
       // release itself.

+ 3 - 3
panda/src/pgraph/pandaNode.h

@@ -800,7 +800,7 @@ public:
   INLINE ~PandaNodePipelineReader();
   ALLOC_DELETED_CHAIN(PandaNodePipelineReader);
 
-  INLINE const PandaNode *get_object() const;
+  INLINE const PandaNode *get_node() const;
   INLINE Thread *get_current_thread() const;
 
   INLINE void release();
@@ -810,7 +810,7 @@ public:
   INLINE void compose_draw_mask(DrawMask &running_draw_mask) const;
   INLINE bool compare_draw_mask(DrawMask running_draw_mask,
                                 DrawMask camera_mask) const;
-  
+
   INLINE int get_num_parents() const;
   INLINE PandaNode *get_parent(int n) const;
   INLINE int find_parent(PandaNode *node) const;
@@ -845,7 +845,7 @@ public:
   INLINE PandaNode::Parents get_parents() const;
 
 private:
-  const PandaNode *_object;
+  const PandaNode *_node;
   Thread *_current_thread;
 
   const PandaNode::CData *_cdata;

+ 35 - 35
panda/src/putil/copyOnWritePointer.I

@@ -20,10 +20,10 @@
 ////////////////////////////////////////////////////////////////////
 INLINE CopyOnWritePointer::
 CopyOnWritePointer(CopyOnWriteObject *object) :
-  _object(object)
+  _cow_object(object)
 {
-  if (_object != (CopyOnWriteObject *)NULL) {
-    _object->cache_ref();
+  if (_cow_object != (CopyOnWriteObject *)NULL) {
+    _cow_object->cache_ref();
   }
 }
 
@@ -34,10 +34,10 @@ CopyOnWritePointer(CopyOnWriteObject *object) :
 ////////////////////////////////////////////////////////////////////
 INLINE CopyOnWritePointer::
 CopyOnWritePointer(const CopyOnWritePointer &copy) :
-  _object(copy._object)
+  _cow_object(copy._cow_object)
 {
-  if (_object != (CopyOnWriteObject *)NULL) {
-    _object->cache_ref();
+  if (_cow_object != (CopyOnWriteObject *)NULL) {
+    _cow_object->cache_ref();
   }
 }
 
@@ -48,7 +48,7 @@ CopyOnWritePointer(const CopyOnWritePointer &copy) :
 ////////////////////////////////////////////////////////////////////
 INLINE void CopyOnWritePointer::
 operator = (const CopyOnWritePointer &copy) {
-  operator = (copy._object);
+  operator = (copy._cow_object);
 }
 
 ////////////////////////////////////////////////////////////////////
@@ -58,13 +58,13 @@ operator = (const CopyOnWritePointer &copy) {
 ////////////////////////////////////////////////////////////////////
 INLINE void CopyOnWritePointer::
 operator = (CopyOnWriteObject *object) {
-  if (_object != object) {
-    if (_object != (CopyOnWriteObject *)NULL) {
-      cache_unref_delete(_object);
+  if (_cow_object != object) {
+    if (_cow_object != (CopyOnWriteObject *)NULL) {
+      cache_unref_delete(_cow_object);
     }
-    _object = object;
-    if (_object != (CopyOnWriteObject *)NULL) {
-      _object->cache_ref();
+    _cow_object = object;
+    if (_cow_object != (CopyOnWriteObject *)NULL) {
+      _cow_object->cache_ref();
     }
   }
 }
@@ -76,8 +76,8 @@ operator = (CopyOnWriteObject *object) {
 ////////////////////////////////////////////////////////////////////
 INLINE CopyOnWritePointer::
 ~CopyOnWritePointer() {
-  if (_object != (CopyOnWriteObject *)NULL) {
-    cache_unref_delete(_object);
+  if (_cow_object != (CopyOnWriteObject *)NULL) {
+    cache_unref_delete(_cow_object);
   }
 }
 
@@ -88,7 +88,7 @@ INLINE CopyOnWritePointer::
 ////////////////////////////////////////////////////////////////////
 INLINE bool CopyOnWritePointer::
 operator == (const CopyOnWritePointer &other) const {
-  return _object == other._object;
+  return _cow_object == other._cow_object;
 }
 
 ////////////////////////////////////////////////////////////////////
@@ -98,7 +98,7 @@ operator == (const CopyOnWritePointer &other) const {
 ////////////////////////////////////////////////////////////////////
 INLINE bool CopyOnWritePointer::
 operator != (const CopyOnWritePointer &other) const {
-  return _object != other._object;
+  return _cow_object != other._cow_object;
 }
 
 ////////////////////////////////////////////////////////////////////
@@ -108,7 +108,7 @@ operator != (const CopyOnWritePointer &other) const {
 ////////////////////////////////////////////////////////////////////
 INLINE bool CopyOnWritePointer::
 operator < (const CopyOnWritePointer &other) const {
-  return _object < other._object;
+  return _cow_object < other._cow_object;
 }
 
 #ifndef COW_THREADED
@@ -124,7 +124,7 @@ operator < (const CopyOnWritePointer &other) const {
 ////////////////////////////////////////////////////////////////////
 INLINE const CopyOnWriteObject *CopyOnWritePointer::
 get_read_pointer() const {
-  return _object;
+  return _cow_object;
 }
 #endif  // COW_THREADED
 
@@ -144,16 +144,16 @@ get_read_pointer() const {
 ////////////////////////////////////////////////////////////////////
 INLINE CopyOnWriteObject *CopyOnWritePointer::
 get_write_pointer() {
-  if (_object == (CopyOnWriteObject *)NULL) {
+  if (_cow_object == (CopyOnWriteObject *)NULL) {
     return NULL;
   }
-  if (_object->get_cache_ref_count() > 1) {
-    PT(CopyOnWriteObject) new_object = _object->make_cow_copy();
-    cache_unref_delete(_object);
-    _object = new_object;
-    _object->cache_ref();
+  if (_cow_object->get_cache_ref_count() > 1) {
+    PT(CopyOnWriteObject) new_object = _cow_object->make_cow_copy();
+    cache_unref_delete(_cow_object);
+    _cow_object = new_object;
+    _cow_object->cache_ref();
   }
-  return _object;
+  return _cow_object;
 }
 #endif  // COW_THREADED
 
@@ -167,7 +167,7 @@ get_write_pointer() {
 ////////////////////////////////////////////////////////////////////
 INLINE CopyOnWriteObject *CopyOnWritePointer::
 get_unsafe_pointer() {
-  return _object;
+  return _cow_object;
 }
 
 ////////////////////////////////////////////////////////////////////
@@ -178,7 +178,7 @@ get_unsafe_pointer() {
 ////////////////////////////////////////////////////////////////////
 bool CopyOnWritePointer::
 is_null() const {
-  return (_object == (CopyOnWriteObject *)NULL);
+  return (_cow_object == (CopyOnWriteObject *)NULL);
 }
 
 ////////////////////////////////////////////////////////////////////
@@ -188,10 +188,10 @@ is_null() const {
 ////////////////////////////////////////////////////////////////////
 void CopyOnWritePointer::
 clear() {
-  if (_object != (CopyOnWriteObject *)NULL) {
-    cache_unref_delete(_object);
+  if (_cow_object != (CopyOnWriteObject *)NULL) {
+    cache_unref_delete(_cow_object);
   }
-  _object = NULL;
+  _cow_object = NULL;
 }
 
 ////////////////////////////////////////////////////////////////////
@@ -203,8 +203,8 @@ clear() {
 ////////////////////////////////////////////////////////////////////
 INLINE bool CopyOnWritePointer::
 test_ref_count_integrity() const {
-  nassertr(_object != (CopyOnWriteObject *)NULL, false);
-  return _object->test_ref_count_integrity();
+  nassertr(_cow_object != (CopyOnWriteObject *)NULL, false);
+  return _cow_object->test_ref_count_integrity();
 }
 
 ////////////////////////////////////////////////////////////////////
@@ -216,8 +216,8 @@ test_ref_count_integrity() const {
 ////////////////////////////////////////////////////////////////////
 INLINE bool CopyOnWritePointer::
 test_ref_count_nonzero() const {
-  nassertr(_object != (CopyOnWriteObject *)NULL, false);
-  return _object->test_ref_count_nonzero();
+  nassertr(_cow_object != (CopyOnWriteObject *)NULL, false);
+  return _cow_object->test_ref_count_nonzero();
 }
 
 #ifndef CPPPARSER

+ 37 - 37
panda/src/putil/copyOnWritePointer.cxx

@@ -30,29 +30,29 @@
 ////////////////////////////////////////////////////////////////////
 CPT(CopyOnWriteObject) CopyOnWritePointer::
 get_read_pointer() const {
-  if (_object == (CopyOnWriteObject *)NULL) {
+  if (_cow_object == (CopyOnWriteObject *)NULL) {
     return NULL;
   }
 
   Thread *current_thread = Thread::get_current_thread();
 
-  MutexHolder holder(_object->_lock_mutex);
-  while (_object->_lock_status == CopyOnWriteObject::LS_locked_write) {
-    if (_object->_locking_thread == current_thread) {
-      return _object;
+  MutexHolder holder(_cow_object->_lock_mutex);
+  while (_cow_object->_lock_status == CopyOnWriteObject::LS_locked_write) {
+    if (_cow_object->_locking_thread == current_thread) {
+      return _cow_object;
     }
     if (util_cat.is_debug()) {
-      util_cat.debug() 
-        << *current_thread << " waiting on " << _object->get_type()
-        << " " << _object << ", held by " << *_object->_locking_thread
+      util_cat.debug()
+        << *current_thread << " waiting on " << _cow_object->get_type()
+        << " " << _cow_object << ", held by " << *_cow_object->_locking_thread
         << "\n";
     }
-    _object->_lock_cvar.wait();
+    _cow_object->_lock_cvar.wait();
   }
 
-  _object->_lock_status = CopyOnWriteObject::LS_locked_read;
-  _object->_locking_thread = current_thread;
-  return _object;
+  _cow_object->_lock_status = CopyOnWriteObject::LS_locked_read;
+  _cow_object->_locking_thread = current_thread;
+  return _cow_object;
 }
 #endif  // COW_THREADED
 
@@ -72,52 +72,52 @@ get_read_pointer() const {
 ////////////////////////////////////////////////////////////////////
 PT(CopyOnWriteObject) CopyOnWritePointer::
 get_write_pointer() {
-  if (_object == (CopyOnWriteObject *)NULL) {
+  if (_cow_object == (CopyOnWriteObject *)NULL) {
     return NULL;
   }
 
   Thread *current_thread = Thread::get_current_thread();
 
-  MutexHolder holder(_object->_lock_mutex);
-  while (_object->_lock_status == CopyOnWriteObject::LS_locked_write &&
-         _object->_locking_thread != current_thread) {
+  MutexHolder holder(_cow_object->_lock_mutex);
+  while (_cow_object->_lock_status == CopyOnWriteObject::LS_locked_write &&
+         _cow_object->_locking_thread != current_thread) {
     if (util_cat.is_debug()) {
-      util_cat.debug() 
-        << *current_thread << " waiting on " << _object->get_type()
-        << " " << _object << ", held by " << *_object->_locking_thread
+      util_cat.debug()
+        << *current_thread << " waiting on " << _cow_object->get_type()
+        << " " << _cow_object << ", held by " << *_cow_object->_locking_thread
         << "\n";
     }
-    _object->_lock_cvar.wait();
+    _cow_object->_lock_cvar.wait();
   }
 
-  if (_object->_lock_status == CopyOnWriteObject::LS_locked_read) {
-    nassertr(_object->get_ref_count() > _object->get_cache_ref_count(), NULL);
+  if (_cow_object->_lock_status == CopyOnWriteObject::LS_locked_read) {
+    nassertr(_cow_object->get_ref_count() > _cow_object->get_cache_ref_count(), NULL);
 
     if (util_cat.is_debug()) {
       util_cat.debug()
-        << "Making copy of " << _object->get_type()
+        << "Making copy of " << _cow_object->get_type()
         << " because it is locked in read mode.\n";
     }
-    PT(CopyOnWriteObject) new_object = _object->make_cow_copy();
-    cache_unref_delete(_object);
-    _object = new_object;
-    _object->cache_ref();
+    PT(CopyOnWriteObject) new_object = _cow_object->make_cow_copy();
+    cache_unref_delete(_cow_object);
+    _cow_object = new_object;
+    _cow_object->cache_ref();
 
-  } else if (_object->get_cache_ref_count() > 1) {
+  } else if (_cow_object->get_cache_ref_count() > 1) {
     // No one else has it specifically read-locked, but there are
     // other CopyOnWritePointers holding the same object, so we should
     // make our own writable copy anyway.
     if (util_cat.is_debug()) {
       util_cat.debug()
-        << "Making copy of " << _object->get_type()
-        << " because it is shared by " << _object->get_ref_count()
+        << "Making copy of " << _cow_object->get_type()
+        << " because it is shared by " << _cow_object->get_ref_count()
         << " pointers.\n";
     }
 
-    PT(CopyOnWriteObject) new_object = _object->make_cow_copy();
-    cache_unref_delete(_object);
-    _object = new_object;
-    _object->cache_ref();
+    PT(CopyOnWriteObject) new_object = _cow_object->make_cow_copy();
+    cache_unref_delete(_cow_object);
+    _cow_object = new_object;
+    _cow_object->cache_ref();
 
   } else {
     // No other thread has the pointer locked, and we're the only
@@ -128,9 +128,9 @@ get_write_pointer() {
     // references to it, though, since the creator of the object might
     // have saved himself a reference.
   }
-  _object->_lock_status = CopyOnWriteObject::LS_locked_write;
-  _object->_locking_thread = current_thread;
+  _cow_object->_lock_status = CopyOnWriteObject::LS_locked_write;
+  _cow_object->_locking_thread = current_thread;
 
-  return _object;
+  return _cow_object;
 }
 #endif  // COW_THREADED

+ 1 - 1
panda/src/putil/copyOnWritePointer.h

@@ -61,7 +61,7 @@ public:
   INLINE bool test_ref_count_nonzero() const;
 
 private:
-  CopyOnWriteObject *_object;
+  CopyOnWriteObject *_cow_object;
 };