summaryrefslogtreecommitdiff
path: root/indra/llcommon/llpointer.h
diff options
context:
space:
mode:
authorRichard Linden <none@none>2012-12-06 00:37:15 -0800
committerRichard Linden <none@none>2012-12-06 00:37:15 -0800
commit60800dacdd7e9b66ed654af471f2b9e9680cd981 (patch)
treef71a65d1ab8a4d277a1ccbd109d852fcc00cba13 /indra/llcommon/llpointer.h
parent68967e7b2b9416ff66cb49ae755fb33d7b81d129 (diff)
SH-3406 WIP convert fast timers to lltrace system
fixed gcc compile error made LLCopyOnWritePointer contain an LLPointer, not derive from it added type trait to control periodicrecording mean value type
Diffstat (limited to 'indra/llcommon/llpointer.h')
-rw-r--r--indra/llcommon/llpointer.h50
1 files changed, 25 insertions, 25 deletions
diff --git a/indra/llcommon/llpointer.h b/indra/llcommon/llpointer.h
index 6a3bbeb768..f03551045e 100644
--- a/indra/llcommon/llpointer.h
+++ b/indra/llcommon/llpointer.h
@@ -166,52 +166,52 @@ protected:
};
template<typename Type>
-class LLCopyOnWritePointer : public LLPointer<Type>
+class LLCopyOnWritePointer
{
public:
- typedef LLPointer<Type> ref_pointer_t;
typedef LLCopyOnWritePointer<Type> self_t;
LLCopyOnWritePointer()
- {
- }
+ {}
LLCopyOnWritePointer(Type* ptr)
- : LLPointer(ptr)
- {
- }
+ : mPointer(ptr)
+ {}
+
+ LLCopyOnWritePointer(LLPointer<Type>& ptr)
+ : mPointer(ptr)
+ {}
Type* write()
{
makeUnique();
- return mPointer;
+ return mPointer.get();
}
void makeUnique()
{
- if (mPointer && mPointer->getNumRefs() > 1)
+ if (mPointer.notNull() && mPointer.get()->getNumRefs() > 1)
{
- ref_pointer_t::assign(new Type(*mPointer));
+ mPointer = new Type(*mPointer.get());
}
}
- using ref_pointer_t::operator BOOL;
- using ref_pointer_t::operator bool;
- using ref_pointer_t::operator!;
-
- using ref_pointer_t::operator !=;
- using ref_pointer_t::operator ==;
- using LLPointer<Type>::operator =;
+ operator BOOL() const { return (BOOL)mPointer; }
+ operator bool() const { return (bool)mPointer; }
+ bool operator!() const { return !mPointer; }
+ bool isNull() const { return mPointer.isNull(); }
+ bool notNull() const { return mPointer.notNull(); }
- using LLPointer<Type>::operator <;
- using LLPointer<Type>::operator >;
-
-
- operator Type*() { return mPointer; }
- operator const Type*() const { return mPointer; }
- Type* operator->() { return mPointer; }
- const Type* operator->() const { return mPointer; }
+ bool operator !=(Type* ptr) const { return (mPointer.get() != ptr); }
+ bool operator ==(Type* ptr) const { return (mPointer.get() == ptr); }
+ bool operator ==(const LLCopyOnWritePointer<Type>& ptr) const { return (mPointer == ptr.mPointer); }
+ bool operator < (const LLCopyOnWritePointer<Type>& ptr) const { return (mPointer < ptr.mPointer); }
+ bool operator > (const LLCopyOnWritePointer<Type>& ptr) const { return (mPointer > ptr.mPointer); }
+ operator const Type*() const { return mPointer.get(); }
+ const Type* operator->() const { return mPointer.get(); }
+protected:
+ LLPointer<Type> mPointer;
};
#endif