summaryrefslogtreecommitdiff
path: root/indra/llcommon/llinstancetracker.h
diff options
context:
space:
mode:
authorNat Goodspeed <nat@lindenlab.com>2012-03-06 11:15:24 -0500
committerNat Goodspeed <nat@lindenlab.com>2012-03-06 11:15:24 -0500
commitf35a662b66e93d916fc439a155aeff6446852405 (patch)
tree884da65c01a892fdb12f6f2f69fbee90c72a4310 /indra/llcommon/llinstancetracker.h
parentca36a06d2e994178cecfae249f7f1cc3af3554a0 (diff)
parent106bac8ed77339e7c986b3066bf96210d327898d (diff)
Automated merge with http://hg.secondlife.com/viewer-development
Diffstat (limited to 'indra/llcommon/llinstancetracker.h')
-rw-r--r--indra/llcommon/llinstancetracker.h21
1 files changed, 17 insertions, 4 deletions
diff --git a/indra/llcommon/llinstancetracker.h b/indra/llcommon/llinstancetracker.h
index 34d841a4e0..403df08990 100644
--- a/indra/llcommon/llinstancetracker.h
+++ b/indra/llcommon/llinstancetracker.h
@@ -167,8 +167,9 @@ public:
static T* getInstance(const KEY& k)
{
- typename InstanceMap::const_iterator found = getMap_().find(k);
- return (found == getMap_().end()) ? NULL : found->second;
+ const InstanceMap& map(getMap_());
+ typename InstanceMap::const_iterator found = map.find(k);
+ return (found == map.end()) ? NULL : found->second;
}
static instance_iter beginInstances()
@@ -239,8 +240,20 @@ class LLInstanceTracker<T, T*> : public LLInstanceTrackerBase
public:
- /// for completeness of analogy with the generic implementation
- static T* getInstance(T* k) { return k; }
+ /**
+ * Does a particular instance still exist? Of course, if you already have
+ * a T* in hand, you need not call getInstance() to @em locate the
+ * instance -- unlike the case where getInstance() accepts some kind of
+ * key. Nonetheless this method is still useful to @em validate a
+ * particular T*, since each instance's destructor removes itself from the
+ * underlying set.
+ */
+ static T* getInstance(T* k)
+ {
+ const InstanceSet& set(getSet_());
+ typename InstanceSet::const_iterator found = set.find(k);
+ return (found == set.end())? NULL : *found;
+ }
static S32 instanceCount() { return getSet_().size(); }
class instance_iter : public boost::iterator_facade<instance_iter, T, boost::forward_traversal_tag>