diff options
Diffstat (limited to 'linden/indra/llmessage/lluseroperation.h')
-rw-r--r-- | linden/indra/llmessage/lluseroperation.h | 94 |
1 files changed, 94 insertions, 0 deletions
diff --git a/linden/indra/llmessage/lluseroperation.h b/linden/indra/llmessage/lluseroperation.h new file mode 100644 index 0000000..18459f5 --- /dev/null +++ b/linden/indra/llmessage/lluseroperation.h | |||
@@ -0,0 +1,94 @@ | |||
1 | /** | ||
2 | * @file lluseroperation.h | ||
3 | * @brief LLUserOperation class header file - used for message based | ||
4 | * transaction. For example, money transactions. | ||
5 | * | ||
6 | * Copyright (c) 2002-2007, Linden Research, Inc. | ||
7 | * | ||
8 | * The source code in this file ("Source Code") is provided by Linden Lab | ||
9 | * to you under the terms of the GNU General Public License, version 2.0 | ||
10 | * ("GPL"), unless you have obtained a separate licensing agreement | ||
11 | * ("Other License"), formally executed by you and Linden Lab. Terms of | ||
12 | * the GPL can be found in doc/GPL-license.txt in this distribution, or | ||
13 | * online at http://secondlife.com/developers/opensource/gplv2 | ||
14 | * | ||
15 | * There are special exceptions to the terms and conditions of the GPL as | ||
16 | * it is applied to this Source Code. View the full text of the exception | ||
17 | * in the file doc/FLOSS-exception.txt in this software distribution, or | ||
18 | * online at http://secondlife.com/developers/opensource/flossexception | ||
19 | * | ||
20 | * By copying, modifying or distributing this software, you acknowledge | ||
21 | * that you have read and understood your obligations described above, | ||
22 | * and agree to abide by those obligations. | ||
23 | * | ||
24 | * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO | ||
25 | * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, | ||
26 | * COMPLETENESS OR PERFORMANCE. | ||
27 | */ | ||
28 | |||
29 | #ifndef LL_LLUSEROPERATION_H | ||
30 | #define LL_LLUSEROPERATION_H | ||
31 | |||
32 | #include "lluuid.h" | ||
33 | #include "llframetimer.h" | ||
34 | |||
35 | #include <map> | ||
36 | |||
37 | class LLUserOperation | ||
38 | { | ||
39 | public: | ||
40 | LLUserOperation(const LLUUID& agent_id); | ||
41 | LLUserOperation(const LLUUID& agent_id, const LLUUID& transaction_id); | ||
42 | virtual ~LLUserOperation(); | ||
43 | |||
44 | const LLUUID& getTransactionID() const { return mTransactionID; } | ||
45 | const LLUUID& getAgentID() const { return mAgentID; } | ||
46 | |||
47 | // Operation never got necessary data, so expired | ||
48 | virtual BOOL isExpired(); | ||
49 | |||
50 | // Send request to the dataserver | ||
51 | virtual void sendRequest() = 0; | ||
52 | |||
53 | // Run the operation. This will only be called in the case of an | ||
54 | // actual success or failure of the operation. | ||
55 | virtual BOOL execute(BOOL transaction_success) = 0; | ||
56 | |||
57 | // This method is called when the user op has expired, and is | ||
58 | // about to be deleted by the manager. This gives the user op the | ||
59 | // ability to nack someone when the user op is never evaluated | ||
60 | virtual void expire(); | ||
61 | |||
62 | protected: | ||
63 | LLUserOperation(); | ||
64 | |||
65 | protected: | ||
66 | LLUUID mAgentID; | ||
67 | LLUUID mTransactionID; | ||
68 | LLFrameTimer mTimer; | ||
69 | }; | ||
70 | |||
71 | |||
72 | class LLUserOperationMgr | ||
73 | { | ||
74 | public: | ||
75 | LLUserOperationMgr(); | ||
76 | ~LLUserOperationMgr(); | ||
77 | |||
78 | void addOperation(LLUserOperation* op); | ||
79 | LLUserOperation* findOperation(const LLUUID& transaction_id); | ||
80 | BOOL deleteOperation(LLUserOperation* op); | ||
81 | |||
82 | // Call this method every once in a while to clean up old | ||
83 | // transactions. | ||
84 | void deleteExpiredOperations(); | ||
85 | |||
86 | private: | ||
87 | typedef std::map<LLUUID, LLUserOperation*> user_operation_list_t; | ||
88 | user_operation_list_t mUserOperationList; | ||
89 | LLUUID mLastOperationConsidered; | ||
90 | }; | ||
91 | |||
92 | extern LLUserOperationMgr* gUserOperationMgr; | ||
93 | |||
94 | #endif // LL_LLUSEROPERATION_H | ||