PageRenderTime 86ms CodeModel.GetById 78ms app.highlight 6ms 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
 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
27#ifndef LL_LLFIXEDBUFFER_H
28#define LL_LLFIXEDBUFFER_H
29
30#include "timer.h"
31#include <deque>
32#include <string>
33#include "llstring.h"
34#include "llthread.h"
35#include "llerrorcontrol.h"
36
37//  fixed buffer implementation
38class LL_COMMON_API LLFixedBuffer : public LLLineBuffer
39{
40public:
41	LLFixedBuffer(const U32 max_lines = 20);
42	~LLFixedBuffer();
43
44	LLTimer	mTimer;
45	U32		mMaxLines;
46	std::deque<LLWString>	mLines;
47	std::deque<F32>			mAddTimes;
48	std::deque<S32>			mLineLengths;
49
50	/*virtual*/ void clear(); // Clear the buffer, and reset it.
51
52	/*virtual*/ void addLine(const std::string& utf8line);
53
54	void setMaxLines(S32 max_lines);
55	
56protected:
57	void removeExtraLines();
58	void addWLine(const LLWString& line);
59
60protected:
61	LLMutex mMutex ;
62};
63
64#endif //LL_FIXED_BUFFER_H