PageRenderTime 37ms CodeModel.GetById 26ms app.highlight 8ms RepoModel.GetById 1ms app.codeStats 0ms

/indra/newview/llassetuploadqueue.h

https://bitbucket.org/lindenlab/viewer-beta/
C++ Header | 91 lines | 47 code | 15 blank | 29 comment | 0 complexity | ba0f96615882758325fff50cd162bc25 MD5 | raw file
 1/** 
 2 * @file llassetuploadqueue.h
 3 * @brief Serializes asset upload request
 4 *
 5 * $LicenseInfo:firstyear=2007&license=viewerlgpl$
 6 * Second Life Viewer Source Code
 7 * Copyright (C) 2010, 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_LLASSETUPLOADQUEUE_H
28#define LL_LLASSETUPLOADQUEUE_H
29
30#include "lluuid.h"
31
32#include <string>
33#include <deque>
34
35class LLAssetUploadQueueSupplier;
36
37class LLAssetUploadQueue
38{
39public:
40
41	// Takes ownership of supplier.
42	LLAssetUploadQueue(LLAssetUploadQueueSupplier* supplier);
43	virtual ~LLAssetUploadQueue();
44
45	void queue(const std::string& filename,
46			   const LLUUID& task_id,
47			   const LLUUID& item_id,
48			   BOOL is_running, 
49			   BOOL is_target_mono, 
50			   const LLUUID& queue_id,
51			   U8* data,
52			   U32 data_size,
53			   std::string script_name);
54
55	bool isEmpty() const {return mQueue.empty();}
56
57private:
58
59	friend class LLAssetUploadChainResponder;
60
61	struct UploadData
62	{
63		std::string mFilename;
64		LLUUID mTaskId;
65		LLUUID mItemId;
66		BOOL mIsRunning;
67		BOOL mIsTargetMono;
68		LLUUID mQueueId;
69		U8* mData;
70		U32 mDataSize;
71		std::string mScriptName;
72	};
73
74	// Ownership of mSupplier passed to currently waiting responder
75	// and returned to queue when no requests in progress.
76	LLAssetUploadQueueSupplier* mSupplier;
77	std::deque<UploadData> mQueue;
78
79	// Passes on ownership of mSupplier if request is made.
80	void request(LLAssetUploadQueueSupplier** supplier);
81};
82
83class LLAssetUploadQueueSupplier
84{
85public:
86	virtual ~LLAssetUploadQueueSupplier();
87	virtual LLAssetUploadQueue* get() const = 0;
88	virtual void log(std::string message) const = 0;
89};
90
91#endif // LL_LLASSETUPLOADQUEUE_H