By mapping files in the process's virtual address space the time required for
processing such files is usually dramatically reduced.
IOmmapStream(std::string const &fname, char const *bufSize = 0,
std::ios::openmode openMode = std::ios::out | std::ios::in,
mode_t mode = 0644):
The constructor initializes the IOmmapStream object for a file named
fname.
The openMode parameter specifies how fname is used. The standard
ios::in, ios::out, ios::trunc, ios::app, and ios::ate modes are
supported.
By default bfIOmmapStream) uses a mapping buffer size of 10 times the standard
page size, (cf. sysconf(3), and the member pageSize below). The size
of the mapping buffer can also be specified using the bufSize
parameter. To specify it use a value followed by K, M, or G,
representing, resp. 1024, 1024 * 1024, and 1024 * 1024 * 1024 bytes. The final
buffer size is at least equal to the standard page size. When a larger value
is specified the used buffer size is set to specified / pageSize *
pageSize.
The mode parameter specifies the user/group/other access mode which is
used when the file is created by MmapBuf. Its default value specifies
read/write access by the user, and read access by others.
)
The move constructor and move assignment operator are available.
The copy constructor and copy assignment operator are not available.
MEMBER FUNCTIONS
All members of std::istream are available, as FBB::IOmmapStream
inherits from that class.
- size_t bufSize() const:
returns the used t(mmap) buffer size;
- size_t fileSize() const:
returns the current size of the used file. The size is updated to a
larger size when writing beyond the current file size. Once the
IOmmapStream object ceases to exist the used file's size is modified to
the current fileSize value.
- size_t pageSize() const:
returns the smallest page size used by t(mmap).
EXAMPLE
An example is provided in bobcat's source archive and gitlab repository at
bobcat/iommapstream/demo.
FILES
bobcat/iommapstream - defines the class interface
SEE ALSO
bobcat(7), chmod(2), immapstream(3bobcat), mmap(2),
mmapbuf(3bobcat), ommapstream(3bobcat), sysconf(3)
BUGS
None Reported.
BOBCAT PROJECT FILES
- https://fbb-git.gitlab.io/bobcat/: gitlab project page;
- bobcat_6.06.02-x.dsc: detached signature;
- bobcat_6.06.02-x.tar.gz: source archive;
- bobcat_6.06.02-x_i386.changes: change log;
- libbobcat1_6.06.02-x_*.deb: debian package containing the
libraries;
- libbobcat1-dev_6.06.02-x_*.deb: debian package containing the
libraries, headers and manual pages;
BOBCAT
Bobcat is an acronym of `Brokken's Own Base Classes And Templates'.
COPYRIGHT
This is free software, distributed under the terms of the
GNU General Public License (GPL).
AUTHOR
Frank B. Brokken (f.b.brokken@rug.nl).