FBB::Sharedpos(3bobcat)

πŸ“¦
version 6.07.01 Β· 5 versions
, in debian trixie, ubuntu questing

πŸ’– FBB::Sharedpos πŸ’–

okay bestie, gather round, because today we're talking about FBB::Sharedpos β€” that's the page you're on, Sharedpos(3bobcat), aka the Shared Memory Offsets legend. it lives in the bobcat manual set and it is, lowkey, the backstage manager of your shared memory vibes. ✨


🌸 NAME 🌸

FBB::Sharedpos β€” the shared memory offset controller. she's in charge. she's the one keeping track. periodt.


πŸŽ€ SYNOPSIS πŸŽ€

#include <bobcat/sharedpos>
Linking option: -lbobcat

πŸ¦‹ DESCRIPTION πŸ¦‹

so SharedPos is a support class for Bobcat's shared memory handling classes. what does that mean? it means she's the girl behind the girl. she controls the shared memory read/write offset, and she makes absolutely sure that shared memory operations never β€” and I mean never β€” exceed the shared memory's maximum offset. no cap. πŸ”₯

SharedPos has several public members, but honestly? they're primarily useful for the other Shared* classes that Bobcat offers. there's probably little use for a stand-alone SharedPos object. she's not a solo artist, she's a group project member who does all the work. 😭

and just so we're clear on vocab, bestie: in the descriptions of the class's member functions, offset refers to the read/write offset within an FBB::SharedSegment(3bobcat) object β€” the object for which SharedPos performs the offset-administration. she's keeping the books. πŸ’…


🌈 NAMESPACE 🌈

FBB

all constructors, members, operators and manipulators mentioned in this man-page are defined in the namespace FBB. yes, all of them. every single one. πŸ’œ


🧚 INHERITS FROM 🧚

-

(as in: nobody. she's self-made. main character energy from the jump. πŸ‘‘)


⭐ TYPEDEFS AND ENUMS ⭐

(nothing here bestie, moving on 🫢)


πŸ“ CONSTRUCTORS πŸ“

default, copy and move constructors are all available, plus the copy and move assignment operators. the whole squad. πŸ™ˆ

the thing is, though: the default constructor does not yet monitor the offset of an FBB::SharedSegment object. she's awake but she hasn't picked up her shift yet. to actually start monitoring offsets, you use the member reset. that's her clocking in. ⏰


✨ OVERLOADED OPERATORS ✨

  • void operator++() β€” the offset gets incremented. but heads up: if this member is called when the offset is equal to the shared memory's maximum offset, an FBB::Exception is thrown. she does not tolerate going over the line, bestie. πŸ’€
  • void operator+=(size_t len) β€” the offset is incremented by len. if offset + len exceeds the shared memory's maximum offset, then the offset is set to the maximum offset and an FBB::Exception is thrown. so she caps it and yells at you. iconic behavior honestly.
  • std::ostream &operator<<(std::ostream &out, SharedPos const &pos) β€” inserts information about the SharedPos object into out. cute little info dump. πŸŽ€

πŸ’… MEMBER FUNCTIONS πŸ’…

note: the behavior of member functions returning values which refer to information of an FBB::SharedSegment is undefined until the member reset has been called. like, undefined undefined. don't test her. 🚨
  • bool atMaxOffset() const β€” returns true if offset equals the maximum offset that can be used for the configured FBB::SharedSegment object. she's at capacity, babe. 🌑️
  • size_t blockIdx() const β€” returns the index of the configured FBB::SharedSegment object's shared segment data block to which offset refers. which block are we in? she knows. πŸ—‚οΈ
  • size_t blockOffset() const β€” returns the offset within the shared segment data block that matches the member offset's return value. so: where are we inside the block. πŸ“
  • bool eof() const β€” returns true if offset exceeds the maximum offset of any character ever written to the shared memory to which the SharedPos object interfaces. and listen β€” if eof returns true, information may still be written to the shared memory: writing is possible until the maximum shared memory segment offset has been reached. so eof being true is not the end of the story, it's more of a vibe check. 😭
  • std::streamsize eos() const β€” returns the offset just beyond the maximum offset for the current shared segment data block. for example: if blockIdx returns 5, and the size of the shared segment data blocks equals 2000, then eos returns 12000 (the first offset of segment 6). math girlies rise. πŸ”₯
  • std::streamsize maxOffset() const β€” returns the maximum possible offset that can be used for the currently monitored FBB::SharedSegment. the ceiling. the limit. the final boss. 🧱
  • std::streamsize offset() const β€” returns the offset within the currently monitored shared memory segment. where are we right now. πŸ“Œ
  • void reset(SharedSegment *sharedData) β€” resets the SharedPos object to monitor the offset of the FBB::SharedSegment object whose address is passed as argument to reset. important, bestie: the address must point to a sharedsegment(3bobcat) object that must exist until the end of the SharedPos object's lifetime, or until its next reset call. do not let it ghost you. πŸ‘» immediately after calling reset, offset is reset to 0. fresh start, clean slate. 🧼
  • std::streamsize showmanyc() const β€” returns the number of characters that can be read from the current shared segment data block. this member interrogates the number of readable characters in the shared memory segment. and here's the tea: this number may change while this member is being executed. 😳 in order to receive a stable return value, calling functions should have obtained a lock on the FBB::SharedSegment data before calling this member. see also the sharedsegment(3bobcat) man-page. lock first, ask questions later. πŸ”’
  • std::ios::pos_type seek(std::ios::off_type offset, std::ios::seekdir origin = std::ios::beg) β€” the monitored offset is changed to this member's offset argument, relative to origin. seeking beyond eof is OK, so don't stress about that. however, -1 is returned when seeking beyond maxOffset or when seeking before the shared segment's offset 0. boundaries, babes. she has them. 🚧

🌸 EXAMPLE 🌸

see the sharedstream(3bobcat) man page. that's where the demo lives. go look. 🫢


πŸ¦‹ FILES πŸ¦‹

bobcat/sharedpos β€” defines the class interface. that's her home address. 🏠


πŸ’– SEE ALSO πŸ’–

bobcat(7), isharedstream(3bobcat), osharedstream(3bobcat), sharedblock(3bobcat), sharedcondition(3bobcat), sharedmemory(3bobcat), sharedmutex(3bobcat), sharedreadme(7bobcat), sharedsegment(3bobcat), sharedstream(3bobcat), sharedbuf(3bobcat)

the whole friend group. they all hang out together. πŸ’œ


😭 BUGS 😭

None Reported.

(we love a clean record. no drama. no bugs. just vibes. ✨)


πŸŽ€ BOBCAT PROJECT FILES πŸŽ€

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. yes, it's a backronym, and yes, it ate. πŸ’…


This is free software, distributed under the terms of the GNU General Public License (GPL). free as in freedom, bestie. πŸ•ŠοΈ


πŸ“ AUTHOR πŸ“

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


and that's the whole page!! thank you for coming to my ted talk πŸ’– this was libbobcat-dev_6.07.01, dated 2005-2025, and she's still serving after all these years. stan a long-running manpage. mwah. πŸ˜˜βœ¨πŸ¦‹

πŸ“¦ where this page comes from