BWAPI
|
00001 #pragma once 00002 #include <iosfwd> // streamsize 00003 #include <string> 00004 00005 #define _SCL_SECURE_NO_WARNINGS 00006 #include <boost/iostreams/categories.hpp> // sink_tag 00007 #include <boost/iostreams/stream.hpp> // sink_tag 00008 00009 class NetDevice { 00010 int sockfd; 00011 00012 public: 00013 NetDevice(const std::string& host, int port); 00014 typedef char char_type; 00015 00016 struct category: boost::iostreams::bidirectional_device_tag, boost::iostreams::closable_tag{}; 00017 std::streamsize read(char* s, std::streamsize n); 00018 std::streamsize write(const char* s, std::streamsize n); 00019 void close(std::ios_base::openmode); 00020 }; 00021 00022 typedef boost::iostreams::stream<NetDevice> NetStream;