diff options
author | Jacek Antonelli | 2008-08-15 23:44:46 -0500 |
---|---|---|
committer | Jacek Antonelli | 2008-08-15 23:44:46 -0500 |
commit | 38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4 (patch) | |
tree | adca584755d22ca041a2dbfc35d4eca01f70b32c /linden/indra/llmessage/llchainio.h | |
parent | README.txt (diff) | |
download | meta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.zip meta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.tar.gz meta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.tar.bz2 meta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.tar.xz |
Second Life viewer sources 1.13.2.12
Diffstat (limited to 'linden/indra/llmessage/llchainio.h')
-rw-r--r-- | linden/indra/llmessage/llchainio.h | 136 |
1 files changed, 136 insertions, 0 deletions
diff --git a/linden/indra/llmessage/llchainio.h b/linden/indra/llmessage/llchainio.h new file mode 100644 index 0000000..c65b3c2 --- /dev/null +++ b/linden/indra/llmessage/llchainio.h | |||
@@ -0,0 +1,136 @@ | |||
1 | /** | ||
2 | * @file llchainio.h | ||
3 | * @author Phoenix | ||
4 | * @date 2005-08-04 | ||
5 | * @brief This class declares the interface for constructing io chains. | ||
6 | * | ||
7 | * Copyright (c) 2005-2007, Linden Research, Inc. | ||
8 | * | ||
9 | * The source code in this file ("Source Code") is provided by Linden Lab | ||
10 | * to you under the terms of the GNU General Public License, version 2.0 | ||
11 | * ("GPL"), unless you have obtained a separate licensing agreement | ||
12 | * ("Other License"), formally executed by you and Linden Lab. Terms of | ||
13 | * the GPL can be found in doc/GPL-license.txt in this distribution, or | ||
14 | * online at http://secondlife.com/developers/opensource/gplv2 | ||
15 | * | ||
16 | * There are special exceptions to the terms and conditions of the GPL as | ||
17 | * it is applied to this Source Code. View the full text of the exception | ||
18 | * in the file doc/FLOSS-exception.txt in this software distribution, or | ||
19 | * online at http://secondlife.com/developers/opensource/flossexception | ||
20 | * | ||
21 | * By copying, modifying or distributing this software, you acknowledge | ||
22 | * that you have read and understood your obligations described above, | ||
23 | * and agree to abide by those obligations. | ||
24 | * | ||
25 | * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO | ||
26 | * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, | ||
27 | * COMPLETENESS OR PERFORMANCE. | ||
28 | */ | ||
29 | |||
30 | #ifndef LL_LLCHAINIO_H | ||
31 | #define LL_LLCHAINIO_H | ||
32 | |||
33 | #include "llpumpio.h" | ||
34 | |||
35 | /** | ||
36 | * @class LLDeferredChain | ||
37 | * @brief This class allows easy addition of a chain which will sleep | ||
38 | * and then process another chain. | ||
39 | */ | ||
40 | class LLDeferredChain | ||
41 | { | ||
42 | public: | ||
43 | /** | ||
44 | * @brief Add a chain to a pump in a finite # of seconds | ||
45 | * | ||
46 | * @prarm pump The pump to work on. | ||
47 | * @prarm in_seconds The number of seconds from now when chain should start. | ||
48 | * @prarm chain The chain to add in in_seconds seconds. | ||
49 | * @prarm chain_timeout timeout for chain on the pump. | ||
50 | * @return Returns true if the operation was queued. | ||
51 | */ | ||
52 | static bool addToPump( | ||
53 | LLPumpIO* pump, | ||
54 | F32 in_seconds, | ||
55 | const LLPumpIO::chain_t& chain, | ||
56 | F32 chain_timeout); | ||
57 | }; | ||
58 | |||
59 | /** | ||
60 | * @class LLChainIOFactory | ||
61 | * @brief This class is an abstract base class for building io chains. | ||
62 | * | ||
63 | * This declares an abstract base class for a chain factory. The | ||
64 | * factory is used to connect an input pipe to the first pipe in the | ||
65 | * chain, and an output pipe to the last pipe in the chain. This will | ||
66 | * allow easy construction for buffer based io like services to for | ||
67 | * API centered IO while abstracting the input and output to simple | ||
68 | * data passing. | ||
69 | * To use this class, you should derive a class which implements the | ||
70 | * <code>build</code> method. | ||
71 | */ | ||
72 | class LLChainIOFactory | ||
73 | { | ||
74 | public: | ||
75 | // Constructor | ||
76 | LLChainIOFactory(); | ||
77 | |||
78 | // Destructor | ||
79 | virtual ~LLChainIOFactory(); | ||
80 | |||
81 | /** | ||
82 | * @brief Build the chian with in as the first and end as the last | ||
83 | * | ||
84 | * The caller of the LLChainIOFactory is responsible for managing | ||
85 | * the memory of the in pipe. All of the chains generated by the | ||
86 | * factory will be ref counted as usual, so the caller will also | ||
87 | * need to break the links in the chain. | ||
88 | * @param chain The chain which will have new pipes appended | ||
89 | * @param context A context for use by this factory if you choose | ||
90 | * @retrun Returns true if the call was successful. | ||
91 | */ | ||
92 | virtual bool build(LLPumpIO::chain_t& chain, LLSD context) const = 0; | ||
93 | |||
94 | protected: | ||
95 | }; | ||
96 | |||
97 | /** | ||
98 | * @class LLSimpleIOFactory | ||
99 | * @brief Basic implementation for making a factory that returns a | ||
100 | * 'chain' of one object | ||
101 | */ | ||
102 | template<class Pipe> | ||
103 | class LLSimpleIOFactory : public LLChainIOFactory | ||
104 | { | ||
105 | public: | ||
106 | virtual bool build(LLPumpIO::chain_t& chain, LLSD context) const | ||
107 | { | ||
108 | chain.push_back(LLIOPipe::ptr_t(new Pipe)); | ||
109 | return true; | ||
110 | } | ||
111 | }; | ||
112 | |||
113 | /** | ||
114 | * @class LLCloneIOFactory | ||
115 | * @brief Implementation for a facory which copies a particular pipe. | ||
116 | */ | ||
117 | template<class Pipe> | ||
118 | class LLCloneIOFactory : public LLChainIOFactory | ||
119 | { | ||
120 | public: | ||
121 | LLCloneIOFactory(Pipe* original) : | ||
122 | mHandle(original), | ||
123 | mOriginal(original) {} | ||
124 | |||
125 | virtual bool build(LLPumpIO::chain_t& chain, LLSD context) const | ||
126 | { | ||
127 | chain.push_back(LLIOPipe::ptr_t(new Pipe(*mOriginal))); | ||
128 | return true; | ||
129 | } | ||
130 | |||
131 | protected: | ||
132 | LLIOPipe::ptr_t mHandle; | ||
133 | Pipe* mOriginal; | ||
134 | }; | ||
135 | |||
136 | #endif // LL_LLCHAINIO_H | ||