includefile(include/header)

COMMENT(manpage, section, releasedate, archive, short name)
manpage(FBB::Sharedpos)(3bobcat)(_CurYrs_)(libbobcat-dev__CurVers_)
                    (Shared Memory Offsets)

manpagename(FBB::Sharedpos)(Shared Memory offset controller)

manpagesynopsis()
    bf(#include <bobcat/sharedpos>)nl()
    Linking option: tt(-lbobcat)

manpagedescription()

    The class bf(SharedPos) is a support class for Bobcat's shared memory
handling classes. It controls the shared memory read/write ofset and ensures
that shared memory operations never exceed the shared memory's maximum offset.

    The class bf(SharedPos) has several public members, but they are primarily
useful for other tt(Shared*) classes offered by Bobcat. There is probably
little use for a stand-alone bf(SharedPos) object.

    In the descriptions of the class's member functions tt(offset) refers to
the read/write offset within a bf(FBB::SharedSegment)(3bobcat) object for
which bf(SharedPos) performs the offset-administration.

includefile(include/namespace)

manpagesection(INHERITS FROM)
    -

manpagesection(TYPEDEFS AND ENUMS)

manpagesection(CONSTRUCTORS)

    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 tt(FBB::SharedSegment)
    object. The member tt(reset) is used to start monitoring offsets.

manpagesection(OVERLOADED OPERATORS)
    itemization(
    itb(void operator++())
       The offset is incremented. If this member is called when the offset is
        equal to the shared memory's maximum offset an tt(FBB::Exception) is
        thrown.

    itb(void operator+=(size_t len))
       The offset is incremented by tt(len). If tt(offset + len) exceeds the
        shared memory's maximum offset then the offset is set to the maximum
        offset and an tt(FBB::Exception) is thrown.

    itb(std::ostream &operator<<(std::ostream &out, SharedPos const &pos))
       Inserts information about the bf(SharedPos) object into tt(out).
    )


manpagesection(MEMBER FUNCTIONS)

    Note: the behavior of member functions returning values which refer to
information of an tt(FBB::SharedSegment) is undefined until the member
tt(reset) has been called.

    itemization(
    itb(bool atMaxOffset() const)
       Returns tt(true) if offset equals the maximum offset that can be used
        for the configured tt(FBB::SharedSegment) object.

    itb(size_t blockIdx() const)
       The index of the configured tt(FBB::SharedSegment) object's shared
        segment data block to which offset refers is returned.

    itb(size_t blockOffset() const)
       The offset within the shared segment data block matching the member
        tt(offset)'s return value is returned.

    itb(bool eof() const)
       Returns tt(true) if offset exceeds the maximum offset of any character
        ever written to the shared memory to which the bf(SharedPos) object
        interfaces. If tt(eof) returns tt(true) information may still be
        em(written) to the shared memory: writing is possible until the
        maximum shared memory segment offset has been reached.

    itb(std::streamsize eos() const)
       The offset just beyond the maximum offset for the current shared
        segment data block is returned. E.g., if tt(blockIdx) returns 5, and
        the size of the shared segment data blocks equals 2000, then tt(eos)
        returns 12000 (the first offset of segment 6).

    itb(std::streamsize maxOffset() const)
       The maximum possible offset that can be used for the currently
        monitored tt(FBB::SharedSegment) is returned.

    itb(std::streamsize offset() const)
       The offset within the currently monitored shared memory segment is
        returned.

    itb(void reset(SharedSegment *sharedData))
       The tt(SharedPos) object is reset to monitor the offset of the
        tt(FBB::SharedSegment) object whose address is passed as argument to
        tt(reset). The address must point to a bf(sharedsegment)(3bobcat)
        object that must exist until the end of the bf(SharedPos)
        object's lifetime or until its next tt(reset) call. Immediately after
        calling tt(reset) offset is reset to 0.

    itb(std::streamsize showmanyc() const)
       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 tt(FBB::SharedSegment) data before calling this member. See also
        the bf(sharedsegment)(3bobcat) man-page.

    itb(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 tt(offset) argument,
        relative to tt(origin). Seeking beyond tt(eof) is OK. However, -1 is
        returned when seeking beyond tt(maxOffset) or seeking before the
        shared segment's offset 0.
    )

manpagesection(EXAMPLE)
    See the bf(sharedstream)(3bobcat) man page.

manpagefiles()
    em(bobcat/sharedpos) - defines the class interface

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

manpagebugs()
    None Reported.

includefile(include/trailer)
