SharedStreambuf(int id, std::ios::openmode openMode = std::ios::in |
std::ios::out):
This constructor connects to a shared memory segment having ID
id. If construction succeeds the shared memory is ready for
use. If construction fails (e.g., no shared memory segment having ID
id exists, an FBB::Exception is thrown. Specifying the
ios::trunc flag or specifying ios::out without also specifying
ios::in immediately clears the contents of the shared
memory.
)
Copy and move constructors are not available.
OVERLOADED OPERATORS
The overloaded move and copy assignment operators are not available.
MEMBER FUNCTIONS
All members of std::streambuf and the enum values kB, MB, and
GB, defined by FBB::SharedEnum__ are available.
- void clear():
The shared memory is first locked. Next, all shared data segment are
returned to the operating system, after which the shared memory
segment is unlocked again. Returning from clear the shared memory
The FBB::SharedMemory object is effectively re-initialized, with
offset and nReadable returning 0.
- int id() const:
The ID of the shared memory segment is returned.
- void kill():
Without locking the shared memory the FBB::SharedStreambuf's shared
memory is deleted. The FBB::SharedStreambuf object is
unusable after returning from kill.
- void remove():
The shared memory is locked, and the FBB::SharedStreambuf's shared
memory is deleted. The FBB::SharedStreambuf object is unusable
after returning from remove.
- void setMemory(SharedMemory &&tmp):
The anonymous temporary SharedMemory object that is passed to
setMemory defines the new shared memory segment to which the
FBB::SharedStreambuf object interfaces. It can also be called
to reuse a FBB::SharedStreambuf object again after calling
kill or remove.
- void memInfo(std::ostream &out):
Information about the SharedMemory object is inserted into the
provide ostream object. The IDs of the shared segments, their
sizes, the maximum number of shared memory segments, the number of
bytes that can be read from the shared memory, and its actual storage
capacity, etc., are displayed. The inserted information is not
terminated by a final newline character.
PROTECTED MEMBER FUNCTION