1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172
|
includefile(include/header)
COMMENT(manpage, section, releasedate, archive, short name)
manpage(FBB::MemoryAccess)(3bobcat)(_CurYrs_)(libbobcat-dev__CurVers_)
(Shared Memory Data)
manpagename(FBB::MemoryAccess)(Shared Memory data structure)
manpagesynopsis()
bf(#include <bobcat/memoryaccess>)nl()
Linking option: tt(-lbobcat )
manpagedescription()
The class bf(FBB::MemoryAccess) manages the access to the shared memory data
blocks used by Bobcat's tt(Memory...) classes. It is not normally used
directly. Instead, it is a support class used by bf(FBB::MemoryBridge).
includefile(include/namespace)
manpagesection(INHERITS FROM)
-
manpagesection(CONSTRUCTORS)
There are no publicly available constructors. The static member
tt(create) (see below) returns a pointer to a tt(MemoryAccess) object.
Copy and move constructors and assignment operators are not available.
Note: the tt(MemoryAccess) destructor performs no actions. See also the
static member tt(create) below.
manpagesection(MEMBER FUNCTIONS)
itemization(
itb(char *beginPtr() const)
Returns a pointer to the first byte of the memory block
(cf. bf(memoryblock)(3bobcat)) corresponding to the current offset
(cf. member tt(offset()), below).
itb(size_t blockBegin() const)
Returns the offset of the first byte of the memory block corresponding
to the current offset.
itb(size_t blockEnd() const)
Returns the offset just beyond the last byte of the memory block
corresponding to the current offset.
itb(size_t bufLimits(size_t offset))
Computes the values returned by tt(blockBegin) and tt(blockEnd)
corresponding to the absolute offset position tt(offset).
itb(char *endPtr() const)
Returns a pointer to the memory block's byte corresponding to offset
tt(blockEnd()).
itb(char *endReadPtr(size_t offset) const)
Returns a pointer to the position in the current memory block
corresponding to the absolute offset position tt(offset).
itb(int id() const)
The ID of the memory block (cf. bf(MemoryAccess)(3bobcat)) controlling
access to the memory data blocks is returned.
itb(void info(std::ostream &out))
Information about the tt(MemoryAccess) is inserted into tt(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.
itb(void load())
Loads (makes available) the memory block corresponding to the current
tt(offset).
itb(size_t maxEnd() const)
Returns the absolute offset position corresponding to tt(blockEnd) of
the current last available memory block. The value returned by this
member can be updated to a larger value after calling tt(extend()).
itb(char *offsetPtr(size_t offset))
Returns a pointer to the byte of the memory block corresponding to
the absolute offset position tt(offset).
itb(size_t read(char *dest, size_t len, size_t offset))
Copies at most tt(len) bytes from absolute offset position tt(offset)
of the tt(MemoryAccess's) data to tt(dest), returning the actual
number of copied bytes. Reading always stops when reaching the value
returned by tt(writtenUntil()) (see below).
itb(bool truncate(std::streamsize offset))
This member reduces or enlarges the available memory size of a
bf(MemoryAccess) object to tt(size). If it's reduced then the shared
memory's data bytes from tt(size) to its original size are set to 0:
newly allocated shared memory areas are always initialized to 0 byte
values.
itb(size_t write(char *src, std::streamsize len, size_t offset))
Copies tt(len) bytes from tt(src) to the tt(MemoryAccess's) data,
starting at the absolute offset position tt(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.
itb(size_t writtenUntil() const)
Returns the highest offset of the byte that was ever written to the
tt(MemoryAccess).
itb(void writtenUntil(size_t offset) const)
Updates the value returned by tt(writtenUntil()) to tt(offset) if
tt(offset) is larger than that value.
)
manpagesection(STATIC MEMBER FUNCTIONS)
itemization(
itb(MemoryAccess *create(std::string const &bufSize, size_t access))
Returns a pointer to a newly created bf(MemoryAccess) object,
defined in the computer's shared memory.
Note: the tt(MemoryAccess) destructor performs no actions. To erase
the tt(MemoryAccess) object made available by tt(create) the static
member tt(drop) (described next) should be used.
Its default capacity is specified by tt(bufSize) (cf. section
tt(BUFSIZE)).
An tt(FBB::Exception) is thrown if the shared memory data segment
could not be created.
itb(void drop(MemoryAccess *ptr, bool erase))
The currently attached shared memory data block and the
tt(MemoryAccess) shared block are detached. If
tt(erase) is tt(true) then all available shared memory blocks and the
shared memory block containing the tt(MemoryAccess) pointed to by
tt(ptr) are destroyed. This member is used by tt(MemoryBridge's)
destructor to disconnect its tt(MemoryAccess) object. The
tt(MemoryAccess) destructor performs no actions.
itb(MemoryAccess *extend(size_t offset, MemoryAccess *ptr))
Returns a newly allocated tt(MemoryAccess) object managing shared data
blocks until at least the absolute offset position
tt(offset). Following tt(extend) the information at tt(ptr) can no
longer be used. The caller is responsible for destroying the
tt(MemoryAccess) object pointed to by tt(ptr).
itb(MemoryAccess *loadID(int id))
Returns a newly allocated tt(MemoryAccess) object managing the shared
data blocks of the tt(MemoryAccess) object having ID tt(id)
(cf. bf(shmat)(2)).
)
manpagesection(BUFSIZE)
includefile(bufsize.inc)
manpagesection(EXAMPLE)
See the bf(memorystream)(3bobcat) man page.
manpagefiles()
em(bobcat/memoryaccess) - defines the class interface
manpageseealso()
bf(bobcat)(7), bf(chmod)(1),
bf(memorybridge)(3bobcat),
bf(memorybuf)(3bobcat),
bf(memorystream)(3bobcat),
bf(shmat)(2),
manpagebugs()
None Reported.
includefile(include/trailer)
|