c++ - Using custom seekable source boost::iostreams::stream -


what methods required implemented if want use custom seekable source boost::iostreams::stream? i've looked @ boost's tutorial source buffers aren't seekable, , tried modifying tag input_seekable , adding seek function in this tutorial. unfortunately, causes compiler complain missing get function can't find documentation (from compiler error message, can figure out signature is, that's it). should function do? there other functions need implement?

also, compiler wants me have 3 input parameters seek; first 1 being *dev thought provided stream itself.

header device:

class sourcebuffer { private:   file *file;  public:   typedef char                              char_type;   typedef boost::iostreams::input_seekable  category;    sourcebuffer(const char *filename);   sourcebuffer();   ~sourcebuffer();    std::streamsize                 read(char *s, std::streamsize n);    boost::iostreams::stream_offset seek(boost::iostreams::stream_offset off, std::ios_base::seekdir way);    void open(const char *filename);   void close(); protected: } 

usage:

boost::iostreams::stream<sourcebuffer> *example; example = new boost::iostreams::stream<sourcebuffer>(filename); 

the exact requirements documented under seekabledevice concept: http://www.boost.org/doc/libs/1_58_0/libs/iostreams/doc/concepts/seekable_device.html

you can @ implementation of of models listed hints on how go this:

  • array,
  • file,
  • file_descriptor,
  • mapped_file

regarding dev* argument seems confusing device::seek (what implement satisfy concept) free function template boost::iostreams::seek


Comments

Popular posts from this blog

PHP DOM loadHTML() method unusual warning -

python - How to create jsonb index using GIN on SQLAlchemy? -

c# - TransactionScope not rolling back although no complete() is called -