IOCPクラス設計の草案
フィクションなソース
このソースはフィクションであり実在の人物・団体とは一切関係ありません
でもなんかうまくいきそう
foreach(pipeline* line in next_piplelines)ってどこのC++ですかw
なんかI/O完了ポートとまったく関係なさそうに見えるorz
struct pipeline { pipeline_element[] elements; void start() { elements[0].start(); } } struct pipeline_element { device dev; void start() { p=new buffer; input(p); } void end(buffer* p) { delete p; } void input(buffer* p) { dev.start(p); } void on_complete(buffer* p,int bytes) { output(p); } void output(buffer* p) { if(next_pipleline_count>0) { buffer buffers[]; //copy from p foreach(pipeline* line in next_piplelines) line->input(buffers[i]); } else end(p); if(dev.iteration) start(); } } struct file_reader_device { iteration=true; void start(buffer* p) { ReadEx(p); } } struct file_writer_device { iteration=false; void start(buffer* p) { WriteEx(p); } } struct reader_buffer_pool_device { iteration=false; binary b; void start(buffer* p) { b << p; on_complete(p); } } struct writer_buffer_pool_device { iteration=false; void write(buffer* p) { on_complete(p); } void start(buffer* p) { } }