/indra/newview/llattachmentsmgr.h
C Header | 73 lines | 26 code | 7 blank | 40 comment | 0 complexity | a7522bd2ccfcdc4093fa82da71853ec0 MD5 | raw file
Possible License(s): LGPL-2.1
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 28#ifndef LL_LLATTACHMENTSMGR_H 29#define LL_LLATTACHMENTSMGR_H 30 31#include "llsingleton.h" 32 33class LLViewerInventoryItem; 34 35//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 36// LLAttachmentsMgr 37// 38// The sole purpose of this class is to take attachment 39// requests, queue them up, and send them all at once. 40// This handles situations where the viewer may request 41// a bunch of attachments at once in a short period of 42// time, where each of the requests would normally be 43// sent as a separate message versus being batched into 44// one single message. 45// 46// The intent of this batching is to reduce viewer->server 47// traffic. 48//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 49class LLAttachmentsMgr: public LLSingleton<LLAttachmentsMgr> 50{ 51public: 52 LLAttachmentsMgr(); 53 virtual ~LLAttachmentsMgr(); 54 55 void addAttachment(const LLUUID& item_id, 56 const U8 attachment_pt, 57 const BOOL add); 58 static void onIdle(void *); 59protected: 60 void onIdle(); 61private: 62 struct AttachmentsInfo 63 { 64 LLUUID mItemID; 65 U8 mAttachmentPt; 66 BOOL mAdd; 67 }; 68 69 typedef std::vector<AttachmentsInfo> attachments_vec_t; 70 attachments_vec_t mPendingAttachments; 71}; 72 73#endif