PageRenderTime 65ms CodeModel.GetById 26ms RepoModel.GetById 1ms app.codeStats 0ms

/indra/llcommon/llfixedbuffer.h

https://bitbucket.org/lindenlab/viewer-beta/
C++ Header | 64 lines | 28 code | 10 blank | 26 comment | 0 complexity | 0cdcd4a32a0d6cb2d7b9b727427cb214 MD5 | raw file
Possible License(s): LGPL-2.1
  1. /**
  2. * @file llfixedbuffer.h
  3. * @brief A fixed size buffer of lines.
  4. *
  5. * $LicenseInfo:firstyear=2001&license=viewerlgpl$
  6. * Second Life Viewer Source Code
  7. * Copyright (C) 2010, Linden Research, Inc.
  8. *
  9. * This library is free software; you can redistribute it and/or
  10. * modify it under the terms of the GNU Lesser General Public
  11. * License as published by the Free Software Foundation;
  12. * version 2.1 of the License only.
  13. *
  14. * This library is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  17. * Lesser General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU Lesser General Public
  20. * License along with this library; if not, write to the Free Software
  21. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  22. *
  23. * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
  24. * $/LicenseInfo$
  25. */
  26. #ifndef LL_LLFIXEDBUFFER_H
  27. #define LL_LLFIXEDBUFFER_H
  28. #include "timer.h"
  29. #include <deque>
  30. #include <string>
  31. #include "llstring.h"
  32. #include "llthread.h"
  33. #include "llerrorcontrol.h"
  34. // fixed buffer implementation
  35. class LL_COMMON_API LLFixedBuffer : public LLLineBuffer
  36. {
  37. public:
  38. LLFixedBuffer(const U32 max_lines = 20);
  39. ~LLFixedBuffer();
  40. LLTimer mTimer;
  41. U32 mMaxLines;
  42. std::deque<LLWString> mLines;
  43. std::deque<F32> mAddTimes;
  44. std::deque<S32> mLineLengths;
  45. /*virtual*/ void clear(); // Clear the buffer, and reset it.
  46. /*virtual*/ void addLine(const std::string& utf8line);
  47. void setMaxLines(S32 max_lines);
  48. protected:
  49. void removeExtraLines();
  50. void addWLine(const LLWString& line);
  51. protected:
  52. LLMutex mMutex ;
  53. };
  54. #endif //LL_FIXED_BUFFER_H