summaryrefslogtreecommitdiff
path: root/Source/modules/asura-base/FileSystem/IOTask.h
diff options
context:
space:
mode:
Diffstat (limited to 'Source/modules/asura-base/FileSystem/IOTask.h')
-rw-r--r--Source/modules/asura-base/FileSystem/IOTask.h56
1 files changed, 56 insertions, 0 deletions
diff --git a/Source/modules/asura-base/FileSystem/IOTask.h b/Source/modules/asura-base/FileSystem/IOTask.h
new file mode 100644
index 0000000..da54fdc
--- /dev/null
+++ b/Source/modules/asura-base/FileSystem/IOTask.h
@@ -0,0 +1,56 @@
+#ifndef _ASURA_IO_TASK_H_
+#define _ASURA_IO_TASK_H_
+
+#include <string>
+
+#include "../Scripting/Scripting.h"
+#include "../Threads/Task.h"
+
+#include "DataBuffer.h"
+
+namespace AsuraEngine
+{
+ namespace FileSystem
+ {
+
+ enum IOTaskType
+ {
+ IOTASK_TYPE_READ,
+ IOTASK_TYPE_WRITE,
+ IOTASK_TYPE_APPEND,
+ };
+
+ ///
+ /// ȡļ
+ ///
+ class IOTask ASURA_FINAL
+ : public AEScripting::Portable<IOTask, AEThreading::Task>
+ {
+ public:
+
+ LUAX_DECL_FACTORY(IOTask);
+
+ IOTask(const std::string& path, DataBuffer* buffer, IOTaskType type);
+ ~IOTask();
+
+ bool Execute() override ;
+ void Invoke(lua_State* invokeThreaad) override;
+
+ private:
+
+ LUAX_DECL_ENUM(IOTaskType);
+
+ LUAX_DECL_METHOD(_New);
+
+ std::string m_Path;
+ IOTaskType m_Type;
+
+ DataBuffer* m_Buffer;
+ Luax::LuaxMemberRef m_BufferRef;
+
+ };
+
+ }
+}
+
+#endif \ No newline at end of file