FBB::MemoryAccess(3bobcat)
πΈ NAME πΈ
FBB::MemoryAccess β shared memory data structure. that's the whole vibe, bestie π
β¨ SYNOPSIS β¨
#include <bobcat/memoryaccess>
Linking option: -lbobcat
π¦ DESCRIPTION π¦
okay so the class FBB::MemoryAccess manages the access to the shared memory data blocks used by Bobcat's Memory... classes. It is not normally used directly. Instead, it's a support class used by FBB::MemoryBridge. she's the backstage crew, not the main character β but nothing on stage works without her, no cap π«Ά
π NAMESPACE π
FBB
every constructor, member, operator and manipulator mentioned in this man-page is defined in the namespace FBB. all of them. not one straggler π
INHERITS FROM
-
yes bestie, that dash means nothing. she's self-made π
π CONSTRUCTORS π
there are no publicly available constructors. The static member create (peep below π) returns a pointer to a MemoryAccess object.
copy and move constructors and assignment operators are also not available. no cloning, no yeeting, no copy-paste energy.
Note: theMemoryAccessdestructor performs no actions. See also the static membercreatebelow.
MEMBER FUNCTIONS
char *beginPtr() constβ returns a pointer to the first byte of the memory block (cf.memoryblock(3bobcat)) corresponding to the current offset (cf. memberoffset(), below).size_t blockBegin() constβ returns the offset of the first byte of the memory block corresponding to the current offset.size_t blockEnd() constβ returns the offset just beyond the last byte of the memory block corresponding to the current offset.size_t bufLimits(size_t offset)β computes the values returned byblockBeginandblockEndcorresponding to the absolute offset position offset.char *endPtr() constβ returns a pointer to the memory block's byte corresponding to offsetblockEnd().char *endReadPtr(size_t offset) constβ returns a pointer to the position in the current memory block corresponding to the absolute offset position offset.int id() constβ the ID of the memory block (cf.MemoryAccess(3bobcat)) controlling access to the memory data blocks is returned. like a little name tag but for shared memory π·οΈvoid info(std::ostream &out)β information about theMemoryAccessis inserted into out: the IDs of the memory data blocks, their sizes, the current maximum number of memory data blocks, the number of bytes that can be read from the shared memory, and its actual storage capacity. it's giving full receipts πvoid load()β loads (makes available) the memory block corresponding to the current offset.size_t maxEnd() constβ returns the absolute offset position corresponding toblockEndof the current last available memory block. The value returned by this member can be updated to a larger value after callingextend().char *offsetPtr(size_t offset)β returns a pointer to the byte of the memory block corresponding to the absolute offset position offset.size_t read(char *dest, size_t len, size_t offset)β copies at most len bytes from absolute offset position offset of theMemoryAccess's data to dest, returning the actual number of copied bytes. Reading always stops when reaching the value returned bywrittenUntil()(see below).bool truncate(std::streamsize offset)β this member reduces or enlarges the available memory size of aMemoryAccessobject to size. If it's reduced then the shared memory's data bytes from size to its original size are set to0: newly allocated shared memory areas are always initialized to0byte values. zeroes on arrival, every time β¨size_t write(char *src, std::streamsize len, size_t offset)β copies len bytes from src to theMemoryAccess's data, starting at the absolute offset position offset, returning the actual number of copied bytes. Unless there's no more physical memory available writing succeeds. If the physical memory is exhausted an exception is thrown. so yeah, watch out for that one.size_t writtenUntil() constβ returns the highest offset of the byte that was ever written to theMemoryAccess. the furthest she's ever been, literally.void writtenUntil(size_t offset) constβ updates the value returned bywrittenUntil()to offset if offset is larger than that value.
π STATIC MEMBER FUNCTIONS π
MemoryAccess *create(std::string const &bufSize, size_t access)β returns a pointer to a newly createdMemoryAccessobject, defined in the computer's shared memory.
Note: theMemoryAccessdestructor performs no actions. To erase theMemoryAccessobject made available bycreatethe static memberdrop(described next) should be used. do not just let it die on its own bestie π
Its default capacity is specified by bufSize (cf. section BUFSIZE).
An FBB::Exception is thrown if the shared memory data segment could not be created.
void drop(MemoryAccess *ptr, bool erase)β the currently attached shared memory data block and theMemoryAccessshared block are detached. If erase istruethen all available shared memory blocks and the shared memory block containing theMemoryAccesspointed to by ptr are destroyed. This member is used byMemoryBridge's destructor to disconnect itsMemoryAccessobject. TheMemoryAccessdestructor performs no actions. the real cleanup queen π§ΉMemoryAccess *extend(size_t offset, MemoryAccess *ptr)β returns a newly allocatedMemoryAccessobject managing shared data blocks until at least the absolute offset position offset. Followingextendthe information at ptr can no longer be used. The caller is responsible for destroying theMemoryAccessobject pointed to by ptr. don't touch ptr afterwards, i repeat, do NOT.MemoryAccess *loadID(int id)β returns a newly allocatedMemoryAccessobject managing the shared data blocks of theMemoryAccessobject having ID id (cf.shmat(2)).
π BUFSIZE π
the bufSize parameter required by the second MemoryStream constructor and the open member (see below) specifies the default number of shared memory blocks and their sizes. The size of the memory blocks is specified as k, M or G, indicating block sizes in kilo-, Mega- and GigaBytes. Before those letters the default number of blocks is specified. E.g., "100M". Internally the number of kiloBytes is converted to pages, using the system's page size, which is commonly equal to 4 kB (so when specifying "5k" then the stream prepares for two shared data segments, each having a capacity of 4 kB. The number of MegaBytes is used as specified, and when specifying GB the data segments are .5 GB.
The number of shared data segments is automatically enlarged when the current capacity is exceeded, and the potentially available data segments are initially not allocated: they're allocated once information is written into their areas. lazy allocation, honestly iconic π¦
π EXAMPLE π
See the memorystream(3bobcat) man page. that's it, go look π
FILES
bobcat/memoryaccessβ defines the class interface
SEE ALSO
bobcat(7), chmod(1), memorybridge(3bobcat), memorybuf(3bobcat), memorystream(3bobcat), shmat(2)
BUGS
None Reported. we love a clean record β¨
π 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'.
COPYRIGHT
This is free software, distributed under the terms of the GNU General Public License (GPL). free and open, as she should be π
AUTHOR
Frank B. Brokken (f.b.brokken@rug.nl).
and that's the whole page bestie, no notes π
this was libbobcat-dev_6.15.01, dated 2005-2026 β shoutout to the FBB::MemoryAccess era, we stay obsessed πβ¨
π¦ 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