logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

FBB::OmmapStream - Input Stream using mmap(2) through FBB::MmapBuf

Author

       Frank B. Brokken (f.b.brokken@rug.nl).

libbobcat-dev_6.07.01                               2005-2025                          FBB::OmmapStream(3bobcat)

Bobcat

       Bobcat is an acronym of `Brokken’s Own Base Classes And Templates’.

Bobcat Project Files

       o      https://fbb-git.gitlab.io/bobcat/: gitlab project page;

       Debian Bobcat project files:

       o      libbobcat6: debian package containing the shared library, changelog and copyright note;

       o      libbobcat-dev:  debian package containing the static library, headers, manual pages, and developer
              info;

Bugs

       None Reported.

Constructors

       o      OmmapStream():
              The  default  constructor  merely constructs an empty OmmapStream object. To change it to a usable
              object use move assignment;

       o      OmmapStream(std::stringconst&fname,charconst*bufSize=0,std::ios::openmodeopenMode=std::ios::out,mode_tmode=0644):
              The constructor initializes the OmmapStream 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 bfOmmapStream) 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.

Description

FBB::OmmapStream  objects  are used to write information to files which are made available in the virtual
       address space of the calling process. Using the virtual address space is handled by the class’s privately
       inherited FBB::MmapBuf (std::streambuf class.

       By mapping files in the process’s virtual address space the time required for processing  such  files  is
       usually dramatically reduced.

       An  std::exception  is  thrown,  and  an  error message is written to cerr if the FBB::MmapBuf base class
       cannot determine the size of the specified file, or when the (un)mapping cannot be performed.

Example

       An example is provided in bobcat’s source archive and gitlab repository at bobcat/ommapstream/demo.

Files

bobcat/ommapstream - defines the class interface

Inherits From

std::ostream, privately from FBB::MmapBuf.

Member Functions

       All members of std::istream are available, as FBB::OmmapStream inherits from that class.

       o      size_tbufSize()const:
              returns the used t(mmap) buffer size;

       o      size_tfileSize()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 OmmapStream object ceases to exist the used file’s size  is
              modified to the current fileSize value.

       o      size_tpageSize()const:
              returns the smallest page size used by t(mmap).

Name

       FBB::OmmapStream - Input Stream using mmap(2) through FBB::MmapBuf

Namespace

FBB
       All constructors, members, operators and manipulators, mentioned in this man-page,  are  defined  in  the
       namespace FBB.

See Also

bobcat(7), chmod(2), immapstream(3bobcat), iommapstream(3bobcat), mmap(2), mmapbuf(3bobcat) sysconf(3)

Synopsis

#include<bobcat/ommapstream>

       Linking option: -lbobcat

See Also