FBB::O...Stream(3bobcat)
π FBB::O...Stream(3bobcat) π
okay bestie, so this one is all about std::ostream on shared memory β literally the page header says std::ostream on shared memory, and the whole thing lives under the FBB::O...Stream(3bobcat) name. It's the manual page for the bobcat library's shared-memory stream stuff. Sit down, hydrate, let's go π«Ά
β¨ NAME β¨
FBB::OSharedStream β std::ostream operations on shared memory. no cap, that's the whole vibe. π
β¨ SYNOPSIS β¨
#include <bobcat/osharedstream>
Linking option: -lpthread -lbobcat
πΈ DESCRIPTION πΈ
So this class gives you all the features of the std::ostream class, but operating on shared memory. That's it, that's the flex. π₯
π NAMESPACE π
FBB
Every constructor, member, operator and manipulator mentioned in this man-page is defined in the namespace FBB.
π¦ INHERITS FROM π¦
FBB::OSharedBuf(and this one is private inheritance, fyi)std::ostreamFBB::SharedEnum__(cf.sharedmemory(3bobcat)for a description of this last base class)
π SIZEUNIT ENUMERATION π
The enum SizeUnit defines these symbolic constants, and yes bestie, the math is right there:
kB, representing1024(2**10) bytes of memory;MB, representing1048576(2**20bytes of memory;GB, representing1073741824(2**30bytes of memory )
β CONSTRUCTORS β
OSharedStream()β the default constructor. It defines a stubOSharedStreamobject that cannot immediately be used to access shared memory. To actually use it, you have to call its memberopenfirst. Stub era, we don't love it but it's valid πOSharedStream(size_t maxSize, SizeUnit sizeUnit, std::ios::openmode openMode = std::ios::out, size_t access = 0600)β this constructor creates anstd::ostreamthat interfaces to a shared memory segment having a capacity of at leastmaxSize * sizeUnitbytes. By default, the shared memory segment is opened for writing. The shared memory's access rights are defined by theaccessparameter, using the well-known (chmod(1)) way to define the 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. πOSharedBuf(int id, std::ios::openmode openMode = std::ios::out | 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. periodt.
π MEMBER FUNCTIONS π
All members of std::istream and std::ostream and the enum values kB, MB, and GB, defined by FBB::OSharedEnum__ are available. iconic inheritance moment.
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 theOSharedStreamobject interfaces. This member does not alter the value returned by the stream'stellpmember. β¨
An FBB::Exception is thrown if the FBB::SharedCondition object could not be constructed.
FBB::SharedCondition createSharedCondition()β returns anFBB::SharedCondition(3)object, interfacing to a newly created shared condition variable which is created at the current offset of theSharedMemoryobject to which theOSharedStreamobject interfaces (or at the first offset of the next physical shared memory data block, cf.sharedcondition(3bobcat)). Creating aSharedConditionobject does not alter the value returned by the stream'stellpmember. π«Ά
An FBB::Exception is thrown if the FBB::SharedCondition object could not be constructed.
int id() constβ the ID of the shared memory segment is returned. πvoid kill()β without locking the shared memory first, all shared memory is returned to the operating system. TheFBB::OSharedStreamobject is unusable after returning fromkill. Other processes that were using the shared memory can continue to do so.
ngl bestie, notice the "without locking the shared memory first" part. this is the feral one. π
void memInfo(std::ostream &out, char const *end = "\n")β information about theOSharedMemoryobject 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 displayed. Following the information about the shaed memory,endis inserted intoout. β¨void open(size_t maxSize, SizeUnit sizeUnit, std::ios::openmode openMode = std::ios::out, 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::OSharedStream. A matchingclosemember does not exist and is not required. 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-known (chmod(1)) way to define the 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 | std::ios::out)β this member connects theFBB::OSharedStreamobject 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::OSharedStreamobject is unusable after returning fromremove. Other processes that were using the shared memory can continue to do so.
see how this one locks first and kill doesn't? that's the whole difference bestie, noted. π
bool truncate(std::streamsize offset)β ifoffsetis not exceeding the value returned byseekp(0, std::ios::end)this latter value is changed tooffsetandtrueis returned. Otherwisefalseis returned, and the value returned byseekpis not altered. If the value returned bytellpexceededoffset,tellp's return value is reduced tooffsetas well. π
π EXAMPLE π
See the sharedstream(3bobcat) man page. (go read it bestie, it's right there π)
π FILES π
bobcat/osharedstream β defines the class interface
πΈ SEE ALSO πΈ
bobcat(7), chmod(1), isharedstream(3bobcat), sharedblock(3bobcat), sharedcondition(3bobcat), sharedmemory(3bobcat) sharedmutex(3bobcat), sharedpos(3bobcat), sharedreadme(7bobcat), sharedsegment(3bobcat), sharedstream(3bobcat), sharedbuf(3bobcat)
π 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);
not me warning you about silent swallowed exceptions, this is the plot twist of the whole page π
π§ 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. it's giving academic but make it cute π
β 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).
aaand that's the page bestie, we ate and left zero crumbs π
β¨ this was libbobcat-dev_6.15.01, dated 2005-2026, and it's the FBB::O...Stream(3bobcat) manual β go forth and share your memory responsibly, 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