.TH "FBB::Sharedpos" "3bobcat" "2005\-2023" "libbobcat\-dev_6\&.04\&.00" "Shared Memory Offsets" .PP .SH "NAME" FBB::Sharedpos \- Shared Memory offset controller .PP .SH "SYNOPSIS" \fB#include \fP .br Linking option: \fI\-lbobcat\fP .PP .SH "DESCRIPTION" .PP The class \fBSharedPos\fP is a support class for Bobcat\(cq\&s shared memory handling classes\&. It controls the shared memory read/write ofset and ensures that shared memory operations never exceed the shared memory\(cq\&s maximum offset\&. .PP The class \fBSharedPos\fP has several public members, but they are primarily useful for other \fIShared*\fP classes offered by Bobcat\&. There is probably little use for a stand\-alone \fBSharedPos\fP object\&. .PP In the descriptions of the class\(cq\&s member functions \fIoffset\fP refers to the read/write offset within a \fBFBB::SharedSegment\fP(3bobcat) object for which \fBSharedPos\fP performs the offset\-administration\&. .PP .SH "NAMESPACE" \fBFBB\fP .br All constructors, members, operators and manipulators, mentioned in this man\-page, are defined in the namespace \fBFBB\fP\&. .PP .SH "INHERITS FROM" \- .PP .SH "TYPEDEFS AND ENUMS" .PP .SH "CONSTRUCTORS" .PP Default, copy and move constructors as well as the copy and move assignment operators are available\&. The default constructor does not yet monitor the offset of an \fIFBB::SharedSegment\fP object\&. The member \fIreset\fP is used to start monitoring offsets\&. .PP .SH "OVERLOADED OPERATORS" .IP o \fBvoid operator++()\fP: .br The offset is incremented\&. If this member is called when the offset is equal to the shared memory\(cq\&s maximum offset an \fIFBB::Exception\fP is thrown\&. .IP .IP o \fBvoid operator+=(size_t len)\fP: .br The offset is incremented by \fIlen\fP\&. If \fIoffset + len\fP exceeds the shared memory\(cq\&s maximum offset then the offset is set to the maximum offset and an \fIFBB::Exception\fP is thrown\&. .IP .IP o \fBstd::ostream &operator<<(std::ostream &out, SharedPos const &pos)\fP: .br Inserts information about the \fBSharedPos\fP object into \fIout\fP\&. .PP .SH "MEMBER FUNCTIONS" .PP Note: the behavior of member functions returning values which refer to information of an \fIFBB::SharedSegment\fP is undefined until the member \fIreset\fP has been called\&. .PP .IP o \fBbool atMaxOffset() const\fP: .br Returns \fItrue\fP if offset equals the maximum offset that can be used for the configured \fIFBB::SharedSegment\fP object\&. .IP .IP o \fBsize_t blockIdx() const\fP: .br The index of the configured \fIFBB::SharedSegment\fP object\(cq\&s shared segment data block to which offset refers is returned\&. .IP .IP o \fBsize_t blockOffset() const\fP: .br The offset within the shared segment data block matching the member \fIoffset\fP\(cq\&s return value is returned\&. .IP .IP o \fBbool eof() const\fP: .br Returns \fItrue\fP if offset exceeds the maximum offset of any character ever written to the shared memory to which the \fBSharedPos\fP object interfaces\&. If \fIeof\fP returns \fItrue\fP information may still be \fIwritten\fP to the shared memory: writing is possible until the maximum shared memory segment offset has been reached\&. .IP .IP o \fBstd::streamsize eos() const\fP: .br The offset just beyond the maximum offset for the current shared segment data block is returned\&. E\&.g\&., if \fIblockIdx\fP returns 5, and the size of the shared segment data blocks equals 2000, then \fIeos\fP returns 12000 (the first offset of segment 6)\&. .IP .IP o \fBstd::streamsize maxOffset() const\fP: .br The maximum possible offset that can be used for the currently monitored \fIFBB::SharedSegment\fP is returned\&. .IP .IP o \fBstd::streamsize offset() const\fP: .br The offset within the currently monitored shared memory segment is returned\&. .IP .IP o \fBvoid reset(SharedSegment *sharedData)\fP: .br The \fISharedPos\fP object is reset to monitor the offset of the \fIFBB::SharedSegment\fP object whose address is passed as argument to \fIreset\fP\&. The address must point to a \fBsharedsegment\fP(3bobcat) object that must exist until the end of the \fBSharedPos\fP object\(cq\&s lifetime or until its next \fIreset\fP call\&. Immediately after calling \fIreset\fP offset is reset to 0\&. .IP .IP o \fBstd::streamsize showmanyc() const\fP: .br The number of characters that can be read from the current shared segment data block is returned\&. This member interrogates the number of readable characters in the shared memory segment\&. 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 \fIFBB::SharedSegment\fP data before calling this member\&. See also the \fBsharedsegment\fP(3bobcat) man\-page\&. .IP .IP o \fBstd::ios::pos_type seek(std::ios::off_type offset, std::ios::seekdir origin = std::ios::beg)\fP: .br The monitored offset is changed to this member\(cq\&s \fIoffset\fP argument, relative to \fIorigin\fP\&. Seeking beyond \fIeof\fP is OK\&. However, \-1 is returned when seeking beyond \fImaxOffset\fP or seeking before the shared segment\(cq\&s offset 0\&. .PP .SH "EXAMPLE" See the \fBsharedstream\fP(3bobcat) man page\&. .PP .SH "FILES" \fIbobcat/sharedpos\fP \- defines the class interface .PP .SH "SEE ALSO" \fBbobcat\fP(7), \fBisharedstream\fP(3bobcat), \fBosharedstream\fP(3bobcat), \fBsharedblock\fP(3bobcat), \fBsharedcondition\fP(3bobcat), \fBsharedmemory\fP(3bobcat), \fBsharedmutex\fP(3bobcat), \fBsharedreadme\fP(7bobcat), \fBsharedsegment\fP(3bobcat), \fBsharedstream\fP(3bobcat), \fBsharedbuf\fP(3bobcat) .PP .SH "BUGS" None Reported\&. .PP .SH "BOBCAT PROJECT FILES" .PP .IP o \fIhttps://fbb\-git\&.gitlab\&.io/bobcat/\fP: gitlab project page; .IP o \fIbobcat_6\&.04\&.00\-x\&.dsc\fP: detached signature; .IP o \fIbobcat_6\&.04\&.00\-x\&.tar\&.gz\fP: source archive; .IP o \fIbobcat_6\&.04\&.00\-x_i386\&.changes\fP: change log; .IP o \fIlibbobcat1_6\&.04\&.00\-x_*\&.deb\fP: debian package containing the libraries; .IP o \fIlibbobcat1\-dev_6\&.04\&.00\-x_*\&.deb\fP: debian package containing the libraries, headers and manual pages; .PP .SH "BOBCAT" Bobcat is an acronym of `Brokken\(cq\&s Own Base Classes And Templates\(cq\&\&. .PP .SH "COPYRIGHT" This is free software, distributed under the terms of the GNU General Public License (GPL)\&. .PP .SH "AUTHOR" Frank B\&. Brokken (\fBf\&.b\&.brokken@rug\&.nl\fP)\&. .PP