PageRenderTime 253ms CodeModel.GetById 111ms app.highlight 5ms RepoModel.GetById 136ms app.codeStats 0ms

/indra/newview/llaccountingcostmanager.h

https://bitbucket.org/lindenlab/viewer-beta/
C++ Header | 75 lines | 32 code | 6 blank | 37 comment | 0 complexity | 1e7f16a32d419578efbfc3811261a4f8 MD5 | raw file
 1/** 
 2 * @file lllAccountingQuotaManager.h
 3 * @
 4 *
 5 * $LicenseInfo:firstyear=2001&license=viewerlgpl$
 6 * Second Life Viewer Source Code
 7 * Copyright (C) 2011, 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_ACCOUNTINGQUOTAMANAGER_H
28#define LL_ACCOUNTINGQUOTAMANAGER_H
29//===============================================================================
30#include "llhandle.h"
31
32#include "llaccountingcost.h"
33//===============================================================================
34// An interface class for panels which display the parcel accounting information.
35class LLAccountingCostObserver
36{
37public:
38	LLAccountingCostObserver() { mObserverHandle.bind(this); }
39	virtual ~LLAccountingCostObserver() {}
40	virtual void onWeightsUpdate(const SelectionCost& selection_cost) = 0;
41	virtual void setErrorStatus(U32 status, const std::string& reason) = 0;
42	const LLHandle<LLAccountingCostObserver>& getObserverHandle() const { return mObserverHandle; }
43	const LLUUID& getTransactionID() { return mTransactionID; }
44
45protected:
46	virtual void generateTransactionID() = 0;
47
48	LLRootHandle<LLAccountingCostObserver> mObserverHandle;
49	LLUUID		mTransactionID;
50};
51//===============================================================================
52class LLAccountingCostManager : public LLSingleton<LLAccountingCostManager>
53{
54public:
55	//Ctor
56	LLAccountingCostManager();
57	//Store an object that will be eventually fetched
58	void addObject( const LLUUID& objectID );
59	//Request quotas for object list
60	void fetchCosts( eSelectionType selectionType, const std::string& url,
61			const LLHandle<LLAccountingCostObserver>& observer_handle );
62	//Delete a specific object from the pending list
63	void removePendingObject( const LLUUID& objectID );
64	
65private:
66	//Set of objects that will be used to generate a cost
67	std::set<LLUUID> mObjectList;
68	//During fetchCosts we move object into a the pending set to signify that 
69	//a fetch has been instigated.
70	std::set<LLUUID> mPendingObjectQuota;
71	typedef std::set<LLUUID>::iterator IDIt;
72};
73//===============================================================================
74
75#endif // LLACCOUNTINGCOSTMANAGER