00001 00034 #ifndef LL_LLCHAINIO_H 00035 #define LL_LLCHAINIO_H 00036 00037 #include "llpumpio.h" 00038 00044 class LLDeferredChain 00045 { 00046 public: 00056 static bool addToPump( 00057 LLPumpIO* pump, 00058 F32 in_seconds, 00059 const LLPumpIO::chain_t& chain, 00060 F32 chain_timeout); 00061 }; 00062 00076 class LLChainIOFactory 00077 { 00078 public: 00079 // Constructor 00080 LLChainIOFactory(); 00081 00082 // Destructor 00083 virtual ~LLChainIOFactory(); 00084 00096 virtual bool build(LLPumpIO::chain_t& chain, LLSD context) const = 0; 00097 00098 protected: 00099 }; 00100 00106 template<class Pipe> 00107 class LLSimpleIOFactory : public LLChainIOFactory 00108 { 00109 public: 00110 virtual bool build(LLPumpIO::chain_t& chain, LLSD context) const 00111 { 00112 chain.push_back(LLIOPipe::ptr_t(new Pipe)); 00113 return true; 00114 } 00115 }; 00116 00121 template<class Pipe> 00122 class LLCloneIOFactory : public LLChainIOFactory 00123 { 00124 public: 00125 LLCloneIOFactory(Pipe* original) : 00126 mHandle(original), 00127 mOriginal(original) {} 00128 00129 virtual bool build(LLPumpIO::chain_t& chain, LLSD context) const 00130 { 00131 chain.push_back(LLIOPipe::ptr_t(new Pipe(*mOriginal))); 00132 return true; 00133 } 00134 00135 protected: 00136 LLIOPipe::ptr_t mHandle; 00137 Pipe* mOriginal; 00138 }; 00139 00140 #endif // LL_LLCHAINIO_H