PageRenderTime 19ms CodeModel.GetById 13ms app.highlight 4ms RepoModel.GetById 1ms app.codeStats 0ms

/indra/llmessage/llioutil.cpp

https://bitbucket.org/lindenlab/viewer-beta/
C++ | 99 lines | 53 code | 7 blank | 39 comment | 3 complexity | 0dec950f8e77f68f4ecb7584f1642edf MD5 | raw file
 1/** 
 2 * @file llioutil.cpp
 3 * @author Phoenix
 4 * @date 2005-10-05
 5 * @brief Utility functionality for the io pipes.
 6 *
 7 * $LicenseInfo:firstyear=2005&license=viewerlgpl$
 8 * Second Life Viewer Source Code
 9 * Copyright (C) 2010, Linden Research, Inc.
10 * 
11 * This library is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU Lesser General Public
13 * License as published by the Free Software Foundation;
14 * version 2.1 of the License only.
15 * 
16 * This library is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
19 * Lesser General Public License for more details.
20 * 
21 * You should have received a copy of the GNU Lesser General Public
22 * License along with this library; if not, write to the Free Software
23 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
24 * 
25 * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
26 * $/LicenseInfo$
27 */
28
29#include "linden_common.h"
30#include "llioutil.h"
31
32/**
33 * LLIOFlush
34 */
35LLIOPipe::EStatus LLIOFlush::process_impl(
36	const LLChannelDescriptors& channels,
37	buffer_ptr_t& buffer,
38	bool& eos,
39	LLSD& context,
40	LLPumpIO* pump)
41{
42	eos = true;
43	return STATUS_OK;
44}
45
46
47static LLFastTimer::DeclareTimer FTM_PROCESS_SLEEP("IO Sleep");
48/** 
49 * @class LLIOSleep
50 */
51LLIOPipe::EStatus LLIOSleep::process_impl(
52	const LLChannelDescriptors& channels,
53	buffer_ptr_t& buffer,
54	bool& eos,
55	LLSD& context,
56	LLPumpIO* pump)
57{
58	LLFastTimer t(FTM_PROCESS_SLEEP);
59	if(mSeconds > 0.0)
60	{
61		if(pump) pump->sleepChain(mSeconds);
62		mSeconds = 0.0;
63		return STATUS_BREAK;
64	}
65	return STATUS_DONE;
66}
67
68static LLFastTimer::DeclareTimer FTM_PROCESS_ADD_CHAIN("Add Chain");
69/** 
70 * @class LLIOAddChain
71 */
72LLIOPipe::EStatus LLIOAddChain::process_impl(
73	const LLChannelDescriptors& channels,
74	buffer_ptr_t& buffer,
75	bool& eos,
76	LLSD& context,
77	LLPumpIO* pump)
78{
79	LLFastTimer t(FTM_PROCESS_ADD_CHAIN);
80	pump->addChain(mChain, mTimeout);
81	return STATUS_DONE;
82}
83
84/**
85 * LLChangeChannel
86 */
87LLChangeChannel::LLChangeChannel(S32 is, S32 becomes) :
88	mIs(is),
89	mBecomes(becomes)
90{
91}
92
93void LLChangeChannel::operator()(LLSegment& segment)
94{
95	if(segment.isOnChannel(mIs))
96	{
97		segment.setChannel(mBecomes);
98	}
99}