PageRenderTime 32ms CodeModel.GetById 22ms RepoModel.GetById 0ms 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
Possible License(s): LGPL-2.1
  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. #include "linden_common.h"
  29. #include "llioutil.h"
  30. /**
  31. * LLIOFlush
  32. */
  33. LLIOPipe::EStatus LLIOFlush::process_impl(
  34. const LLChannelDescriptors& channels,
  35. buffer_ptr_t& buffer,
  36. bool& eos,
  37. LLSD& context,
  38. LLPumpIO* pump)
  39. {
  40. eos = true;
  41. return STATUS_OK;
  42. }
  43. static LLFastTimer::DeclareTimer FTM_PROCESS_SLEEP("IO Sleep");
  44. /**
  45. * @class LLIOSleep
  46. */
  47. LLIOPipe::EStatus LLIOSleep::process_impl(
  48. const LLChannelDescriptors& channels,
  49. buffer_ptr_t& buffer,
  50. bool& eos,
  51. LLSD& context,
  52. LLPumpIO* pump)
  53. {
  54. LLFastTimer t(FTM_PROCESS_SLEEP);
  55. if(mSeconds > 0.0)
  56. {
  57. if(pump) pump->sleepChain(mSeconds);
  58. mSeconds = 0.0;
  59. return STATUS_BREAK;
  60. }
  61. return STATUS_DONE;
  62. }
  63. static LLFastTimer::DeclareTimer FTM_PROCESS_ADD_CHAIN("Add Chain");
  64. /**
  65. * @class LLIOAddChain
  66. */
  67. LLIOPipe::EStatus LLIOAddChain::process_impl(
  68. const LLChannelDescriptors& channels,
  69. buffer_ptr_t& buffer,
  70. bool& eos,
  71. LLSD& context,
  72. LLPumpIO* pump)
  73. {
  74. LLFastTimer t(FTM_PROCESS_ADD_CHAIN);
  75. pump->addChain(mChain, mTimeout);
  76. return STATUS_DONE;
  77. }
  78. /**
  79. * LLChangeChannel
  80. */
  81. LLChangeChannel::LLChangeChannel(S32 is, S32 becomes) :
  82. mIs(is),
  83. mBecomes(becomes)
  84. {
  85. }
  86. void LLChangeChannel::operator()(LLSegment& segment)
  87. {
  88. if(segment.isOnChannel(mIs))
  89. {
  90. segment.setChannel(mBecomes);
  91. }
  92. }