PageRenderTime 35ms CodeModel.GetById 20ms RepoModel.GetById 1ms 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
Possible License(s): LGPL-2.1
  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. #ifndef LL_ACCOUNTINGQUOTAMANAGER_H
  27. #define LL_ACCOUNTINGQUOTAMANAGER_H
  28. //===============================================================================
  29. #include "llhandle.h"
  30. #include "llaccountingcost.h"
  31. //===============================================================================
  32. // An interface class for panels which display the parcel accounting information.
  33. class LLAccountingCostObserver
  34. {
  35. public:
  36. LLAccountingCostObserver() { mObserverHandle.bind(this); }
  37. virtual ~LLAccountingCostObserver() {}
  38. virtual void onWeightsUpdate(const SelectionCost& selection_cost) = 0;
  39. virtual void setErrorStatus(U32 status, const std::string& reason) = 0;
  40. const LLHandle<LLAccountingCostObserver>& getObserverHandle() const { return mObserverHandle; }
  41. const LLUUID& getTransactionID() { return mTransactionID; }
  42. protected:
  43. virtual void generateTransactionID() = 0;
  44. LLRootHandle<LLAccountingCostObserver> mObserverHandle;
  45. LLUUID mTransactionID;
  46. };
  47. //===============================================================================
  48. class LLAccountingCostManager : public LLSingleton<LLAccountingCostManager>
  49. {
  50. public:
  51. //Ctor
  52. LLAccountingCostManager();
  53. //Store an object that will be eventually fetched
  54. void addObject( const LLUUID& objectID );
  55. //Request quotas for object list
  56. void fetchCosts( eSelectionType selectionType, const std::string& url,
  57. const LLHandle<LLAccountingCostObserver>& observer_handle );
  58. //Delete a specific object from the pending list
  59. void removePendingObject( const LLUUID& objectID );
  60. private:
  61. //Set of objects that will be used to generate a cost
  62. std::set<LLUUID> mObjectList;
  63. //During fetchCosts we move object into a the pending set to signify that
  64. //a fetch has been instigated.
  65. std::set<LLUUID> mPendingObjectQuota;
  66. typedef std::set<LLUUID>::iterator IDIt;
  67. };
  68. //===============================================================================
  69. #endif // LLACCOUNTINGCOSTMANAGER