19 #ifndef INCLUDE_RCF_FILEIOTHREADPOOL_HPP
20 #define INCLUDE_RCF_FILEIOTHREADPOOL_HPP
24 #include <boost/shared_ptr.hpp>
26 #include <RCF/ByteBuffer.hpp>
27 #include <RCF/Exception.hpp>
28 #include <RCF/Export.hpp>
29 #include <RCF/ThreadLibrary.hpp>
30 #include <RCF/ThreadPool.hpp>
35 typedef boost::shared_ptr<FileIoRequest> FileIoRequestPtr;
37 class RCF_EXPORT FileIoThreadPool
44 void registerOp(FileIoRequestPtr opPtr);
45 void unregisterOp(FileIoRequestPtr opPtr);
47 void setSerializeFileIo(
bool serializeFileIo);
51 friend class FileIoRequest;
56 bool mSerializeFileIo;
59 RCF::Condition mOpsCondition;
60 std::deque< FileIoRequestPtr > mOpsQueued;
61 std::deque< FileIoRequestPtr > mOpsInProgress;
65 RCF::Mutex mCompletionMutex;
66 RCF::Condition mCompletionCondition;
69 typedef boost::shared_ptr< std::ifstream > IfstreamPtr;
70 typedef boost::shared_ptr< std::ofstream > OfstreamPtr;
72 class RCF_EXPORT FileIoRequest :
73 public boost::enable_shared_from_this<FileIoRequest>
82 void initiateRead(IfstreamPtr finPtr, RCF::ByteBuffer buffer);
83 void initateWrite(OfstreamPtr foutPtr, RCF::ByteBuffer buffer);
85 boost::uint64_t getBytesTransferred();
89 friend class FileIoThreadPool;
93 FileIoThreadPool & mFts;
98 RCF::ByteBuffer mBuffer;
99 boost::uint64_t mBytesTransferred;
102 RCF::Exception mError;
105 RCF_EXPORT FileIoThreadPool & getFileIoThreadPool();
110 #endif // ! INCLUDE_RCF_FILEIOTHREADPOOL_HPP