00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef Fennel_ExecStreamEmbryo_Included
00025 #define Fennel_ExecStreamEmbryo_Included
00026
00027 #include <boost/bind.hpp>
00028 #include <boost/function.hpp>
00029
00030 FENNEL_BEGIN_NAMESPACE
00031
00048 class FENNEL_EXEC_EXPORT ExecStreamEmbryo
00049 {
00053 SharedExecStream pStream;
00054
00058 SharedExecStreamParams pParams;
00059
00063 boost::function<void ()> prepareFunction;
00064
00065 public:
00066
00080 template<class S, class P>
00081 inline void init(S *pStreamInit, P const ¶msInit)
00082 {
00083 pStream.reset(pStreamInit, ClosableObjectDestructor());
00084 P *pParamCopy = new P(paramsInit);
00085 pParams.reset(pParamCopy);
00086 prepareFunction = boost::bind(
00087 &S::prepare, pStreamInit, boost::ref(*pParamCopy));
00088 }
00089
00090 inline SharedExecStream &getStream()
00091 {
00092 return pStream;
00093 }
00094
00095 inline SharedExecStreamParams &getParams()
00096 {
00097 return pParams;
00098 }
00099
00103 inline void prepareStream()
00104 {
00105 prepareFunction();
00106 }
00107 };
00108
00109 FENNEL_END_NAMESPACE
00110
00111 #endif
00112
00113