diff options
author | Kyle Ambroff <ambroff@lindenlab.com> | 2008-06-21 07:39:52 +0000 |
---|---|---|
committer | Kyle Ambroff <ambroff@lindenlab.com> | 2008-06-21 07:39:52 +0000 |
commit | dc3f5ff87cfa085998bf69db6dedad45440419d3 (patch) | |
tree | e6c54376390a110e0e91ea0139ce6bb54925ffae /indra/llcommon/llkeythrottle.h | |
parent | af080d1c62f1a2cdc17c3870427f07ad0cf9534f (diff) |
svn merge -r90150:90340 svn+ssh://svn.lindenlab.com/svn/linden/branches/qar-699_combo-merge --> release
QAR-699 - Combo merge for QAR-687, QAR-637, QAR-586
* QAR-687 - Test build with libs on S3
* QAR-637 Test dynamic sound throttle
* QAR-586 Test new http features branch
Diffstat (limited to 'indra/llcommon/llkeythrottle.h')
-rw-r--r-- | indra/llcommon/llkeythrottle.h | 35 |
1 files changed, 20 insertions, 15 deletions
diff --git a/indra/llcommon/llkeythrottle.h b/indra/llcommon/llkeythrottle.h index 61a43b2dad..ac2f4254f2 100644 --- a/indra/llcommon/llkeythrottle.h +++ b/indra/llcommon/llkeythrottle.h @@ -55,28 +55,31 @@ class LLKeyThrottleImpl protected: struct Entry { U32 count; - BOOL blocked; + bool blocked; - Entry() : count(0), blocked(FALSE) { } + Entry() : count(0), blocked(false) { } }; typedef std::map<T, Entry> EntryMap; - EntryMap * prevMap; - EntryMap * currMap; + EntryMap* prevMap; + EntryMap* currMap; U32 countLimit; // maximum number of keys allowed per interval U64 intervalLength; // each map covers this time period (usec or frame number) U64 startTime; // start of the time period (usec or frame number) - // currMap started counting at this time // prevMap covers the previous interval - LLKeyThrottleImpl() : prevMap(0), currMap(0), - countLimit(0), intervalLength(1), - startTime(0) { }; + LLKeyThrottleImpl() : + prevMap(NULL), + currMap(NULL), + countLimit(0), + intervalLength(1), + startTime(0) + {} static U64 getTime() { @@ -93,7 +96,9 @@ template< class T > class LLKeyThrottle { public: - LLKeyThrottle(U32 limit, F32 interval, BOOL realtime = TRUE) // realtime = FALSE for frame-based throttle, TRUE for usec real-time throttle + // @param realtime = FALSE for frame-based throttle, TRUE for usec + // real-time throttle + LLKeyThrottle(U32 limit, F32 interval, BOOL realtime = TRUE) : m(* new LLKeyThrottleImpl<T>) { setParameters( limit, interval, realtime ); @@ -149,7 +154,7 @@ public: } U32 prevCount = 0; - BOOL prevBlocked = FALSE; + bool prevBlocked = false; typename LLKeyThrottleImpl<T>::EntryMap::const_iterator prev = m.prevMap->find(id); if (prev != m.prevMap->end()) @@ -198,17 +203,17 @@ public: noteAction(id); typename LLKeyThrottleImpl<T>::Entry& curr = (*m.currMap)[id]; curr.count = llmax(m.countLimit, curr.count); - curr.blocked = TRUE; + curr.blocked = true; } - // returns TRUE if key is blocked - BOOL isThrottled(const T& id) const + // returns true if key is blocked + bool isThrottled(const T& id) const { if (m.currMap->empty() && m.prevMap->empty()) { // most of the time we'll fall in here - return FALSE; + return false; } // NOTE, we ignore the case where id is in the map but the map is stale. @@ -226,7 +231,7 @@ public: { return entry->second.blocked; } - return FALSE; + return false; } // Get the throttling parameters |