/indra/newview/llattachmentsmgr.h

https://bitbucket.org/lindenlab/viewer-beta/ · C Header · 73 lines · 26 code · 7 blank · 40 comment · 0 complexity · a7522bd2ccfcdc4093fa82da71853ec0 MD5 · raw file

  1. /**
  2. * @file llattachmentsmgr.h
  3. * @brief Batches up attachment requests and sends them all
  4. * in one message.
  5. *
  6. * $LicenseInfo:firstyear=2004&license=viewerlgpl$
  7. * Second Life Viewer Source Code
  8. * Copyright (C) 2010, Linden Research, Inc.
  9. *
  10. * This library is free software; you can redistribute it and/or
  11. * modify it under the terms of the GNU Lesser General Public
  12. * License as published by the Free Software Foundation;
  13. * version 2.1 of the License only.
  14. *
  15. * This library is distributed in the hope that it will be useful,
  16. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  18. * Lesser General Public License for more details.
  19. *
  20. * You should have received a copy of the GNU Lesser General Public
  21. * License along with this library; if not, write to the Free Software
  22. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  23. *
  24. * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
  25. * $/LicenseInfo$
  26. */
  27. #ifndef LL_LLATTACHMENTSMGR_H
  28. #define LL_LLATTACHMENTSMGR_H
  29. #include "llsingleton.h"
  30. class LLViewerInventoryItem;
  31. //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  32. // LLAttachmentsMgr
  33. //
  34. // The sole purpose of this class is to take attachment
  35. // requests, queue them up, and send them all at once.
  36. // This handles situations where the viewer may request
  37. // a bunch of attachments at once in a short period of
  38. // time, where each of the requests would normally be
  39. // sent as a separate message versus being batched into
  40. // one single message.
  41. //
  42. // The intent of this batching is to reduce viewer->server
  43. // traffic.
  44. //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  45. class LLAttachmentsMgr: public LLSingleton<LLAttachmentsMgr>
  46. {
  47. public:
  48. LLAttachmentsMgr();
  49. virtual ~LLAttachmentsMgr();
  50. void addAttachment(const LLUUID& item_id,
  51. const U8 attachment_pt,
  52. const BOOL add);
  53. static void onIdle(void *);
  54. protected:
  55. void onIdle();
  56. private:
  57. struct AttachmentsInfo
  58. {
  59. LLUUID mItemID;
  60. U8 mAttachmentPt;
  61. BOOL mAdd;
  62. };
  63. typedef std::vector<AttachmentsInfo> attachments_vec_t;
  64. attachments_vec_t mPendingAttachments;
  65. };
  66. #endif