FBB::I...Stream(3bobcat)
π FBB::I...Stream(3bobcat) π
okay so bestie, this whole page lives in the bobcat manual, and it's all about FBB::ISharedStream β the β¨ shared-memory edition β¨ of std::istream. Buckle up, it's lowkey iconic.
πΈ NAME πΈ
FBB::ISharedStream β literally std::istream operations, but on shared memory π
β¨ SYNOPSIS β¨
#include <bobcat/isharedstream>
Linking option: -lpthread -lbobcat
π¦ DESCRIPTION π¦
so basically this class is out here serving you all the features of the std::istream class, except it's operating on shared memory. that's the whole vibe. no cap π«Ά
π NAMESPACE π
FBB
every constructor, member, operator and manipulator that gets mentioned on this page is defined in the namespace FBB. periodt.
π INHERITS FROM π
FBB::ISharedBuf(private inheritance, iykyk)std::istreamFBB::SharedEnum__β and fr, checksharedmemory(3bobcat)if you wanna know what's up with this last base class π
π§ SIZEUNIT ENUMERATION π§
the enum SizeUnit defines these symbolic constants, and they're giving units of memory:
kBβ representing 1024 (2**10) bytes of memory πMBβ representing 1048576 (2**20) bytes of memory πGBβ representing 1073741824 (2**30) bytes of memory π₯
π CONSTRUCTORS π
ISharedStream()β the default constructor. it defines a stubISharedStreamobject that cannot immediately be used to access shared memory. to actually use it you have to call its memberopenfirst, bestie. no skipping steps πISharedStream(size_t maxSize, SizeUnit sizeUnit, std::ios::openmode openMode = std::ios::in, size_t access = 0600)β this one creates anstd::istreamthat interfaces to a shared memory segment with a capacity of at leastmaxSize * sizeUnitbytes. by default the shared memory segment is opened for reading. and here's the thing β different from the open modes used for file streams, creating a shared memory stream with open modesios::inis OK. in this case the shared memory segment is created, and once information has been written to the shared memory by another process (or object), the information can be read. the shared memory's access rights are defined by theaccessparameter, using the well-knownchmod(1)way to define access rights for the owner, the group and others, using octal digits. if construction succeeds, the shared memory is ready for use. if construction fails, anFBB::Exceptionis thrown πISharedStream(int id, std::ios::openmode openMode = std::ios::in)β this constructor creates anstd::istreamthat connects to a shared memory segment having IDid. if construction succeeds the shared memory is ready for use. if construction fails (e.g., no shared memory segment having IDidexists), anFBB::Exceptionis thrown π
β οΈ copy and move constructors (and assignment operators) are not available. like, they simply do not exist. don't come for them.
π«Ά MEMBER FUNCTIONS π«Ά
all members of std::istream, and the enum values kB, MB, and GB, defined by FBB::ISharedEnum__, are available. slay.
FBB::SharedCondition attachSharedCondition(std::ios::off_type offset, std::ios::seekdir origin)β returns anFBB::SharedCondition(3)object, interfacing to a shared condition variable located atoffsetoffset(relative toorigin) in theSharedMemoryobject to which theISharedStreamobject interfaces. this member does not alter the value returned by the stream'stellgmember. anFBB::Exceptionis thrown if theFBB::SharedConditionobject could not be constructed π€int id() constβ the ID of the shared memory segment is returned. cute and simple β¨void kill()β without locking the shared memory first, all shared memory is returned to the operating system. theFBB::ISharedStreamobject is unusable after returning fromkill. other processes that were using the shared memory can continue to do so. yeah, it's as dramatic as it sounds π₯void memInfo(std::ostream &out, char const *end = "\n")β information about theISharedMemoryobject is inserted into the providedostreamobject. the IDs of the shared segments, their sizes, the maximum number of shared memory segments, the number of bytes that can be read from the shared memory, and its actual storage capacity, etc., are all displayed. following the information about the shared memory,endis inserted intooutπvoid open(size_t maxSize, SizeUnit sizeUnit, std::ios::openmode openMode = std::ios::in, size_t access = 0600)β this member creates a shared memory segment having a capacity of at leastmaxSize * sizeUnitbytes, and connects the shared memory segment to theFBB::ISharedStream. a matchingclosemember does not exist and is not required (so don't go looking for one, babe). by default the shared memory segment is opened for reading. different from the open modes used for file streams, creating a shared memory stream with open modesios::inis OK. in this case the shared memory segment is created, and once information has been written to the shared memory by another process it can be read. the shared memory's access rights are defined by theaccessparameter, using the well-knownchmod(1)way to define access rights for the owner, the group and others, using octal digits. if opening succeeds the shared memory is ready for use. if opening fails, anFBB::Exceptionis thrown π₯²void open(int id, std::ios::openmode openMode = std::ios::in)β this member connects theFBB::ISharedStreamobject to a shared memory segment having IDid. a matchingclosemember does not exist and is not required. if opening succeeds the shared memory is ready for use. if opening fails (e.g., no shared memory segment having IDidexists), anFBB::Exceptionis thrown πvoid remove()β the shared memory is first locked. next, all shared memory is returned to the operating system. theFBB::ISharedStreamobject is unusable after returning fromremove. other processes that were using the shared memory can continue to do so. locked-then-nuked, that's the order of operations πbool truncate(std::streamsize offset)β ifoffsetis not exceeding the value returned byseekg(0, std::ios::end), then this latter value is changed tooffsetandtrueis returned. otherwisefalseis returned, and the value returned byseekgis not altered. if the value returned bytellgexceededoffset,tellg's return value is reduced tooffsetas well. subsequent read operations on the shared memory can only succeed as long astellg's return value hasn't reached the valueoffsetβ
π EXAMPLE π
see the sharedstream(3bobcat) man page. go go go πββοΈ
πΈ FILES πΈ
bobcat/isharedstream β defines the class interface π
π₯ SEE ALSO π₯
bobcat(7), chmod(1), osharedstream(3bobcat), sharedblock(3bobcat), sharedcondition(3bobcat), sharedmemory(3bobcat), sharedmutex(3bobcat), sharedpos(3bobcat), sharedreadme(7bobcat), sharedsegment(3bobcat), sharedstream(3bobcat), sharedbuf(3bobcat) β the whole friend group, fr fr π«Ά
π BUGS π
note that by default, exceptions thrown from within a std::stream object are caught by the stream object, setting its ios::failbit flag. to allow exceptions to leave a stream object, its exceptions member can be called, e.g., using:
myStream.exceptions(ios::failbit | ios::badbit | ios::eofbit);
so yeah, if your exception is being swallowed, that's why bestie π
π¦ BOBCAT PROJECT FILES π¦
https://fbb-git.gitlab.io/bobcat/β gitlab project page π
Debian Bobcat project files:
libbobcat6β debian package containing the shared library, changelog and copyright note πlibbobcat-devβ debian package containing the static library, headers, manual pages, and developer info β¨
π BOBCAT π
Bobcat is an acronym of Brokken's Own Base Classes And Templates. ate that backronym up, honestly π
π 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). π
and that's the whole page, bestie! this one came from libbobcat-dev_6.15.01, dated 2005-2026, in the FBB::I...Stream(3bobcat) corner of the manual. stay hydrated, read your man pages, mwah π
β¨
π¦ where this page comes from
- ubuntu stonking: libbobcat-dev 6.15.01-1 Β· GPL-3.0-or-later WITH OpenSSL exception
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms