/usr/include/bobcat/sharedstreambuf is in libbobcat-dev 4.01.03-2ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 | #ifndef INCLUDED_BOBCAT_SHAREDSTREAMBUF_
#define INCLUDED_BOBCAT_SHAREDSTREAMBUF_
#include <ios>
#include <streambuf>
#include <bobcat/sharedmemory>
#include <bobcat/sharedcondition>
namespace FBB
{
class SharedStreambuf: public std::streambuf, public virtual SharedEnum__
{
std::ios::openmode d_openMode;
std::ios::openmode d_currentMode; // initially openMode, thereafter
// either ::in or ::out
SharedMemory d_memory;
public:
SharedStreambuf(); // 1
SharedStreambuf(
size_t maxSize, SizeUnit sizeUnit, // 2
std::ios::openmode openMode = std::ios::in | std::ios::out,
size_t access = 0600);
SharedStreambuf( // 3
int id,
std::ios::openmode openMode = std::ios::in | std::ios::out);
virtual ~SharedStreambuf();
void clear(); // clear all existing data and reduce
// until only the segment at
// d_sharedData
int id() const; // id of the shared Memory segment
void kill(); // kill all shared segments w/o locks
// the object is unusable hereafter
void memInfo(std::ostream &out) const;
void remove(); // remove all shared segments.
// the object is unusable hereafter
void setMemory(SharedMemory &&tmp);
protected:
SharedCondition attachSharedCondition(std::ios::off_type offset = 0,
std::ios::seekdir way = std::ios::beg);
SharedCondition createSharedCondition();
void setOpenMode(std::ios::openmode openMode);
SharedMemory &sharedMemory();
private:
bool mode(std::ios::openmode flag);
int pbackfail(int ch) override;
std::streamsize showmanyc() override;
int underflow() override;
std::streamsize xsgetn(char *buf, std::streamsize n) override;
int overflow(int c) override;
std::streamsize xsputn(char const *buf, std::streamsize n) override;
std::ios::pos_type seekoff(
std::ios::off_type offset,
std::ios::seekdir way = std::ios::beg,
std::ios::openmode mode = std::ios::in | std::ios::out) override;
std::ios::pos_type seekpos(
std::ios::pos_type offset,
std::ios::openmode mode = std::ios::in | std::ios::out) override;
};
inline void SharedStreambuf::clear()
{
d_memory.clear();
}
inline int SharedStreambuf::id() const
{
return d_memory.id();
}
inline void SharedStreambuf::kill()
{
d_memory.kill();
}
inline void SharedStreambuf::memInfo(std::ostream &out) const
{
out << d_memory;
}
inline void SharedStreambuf::remove()
{
d_memory.remove();
}
inline void SharedStreambuf::setMemory(SharedMemory &&tmp)
{
d_memory = std::move(tmp);
}
inline void SharedStreambuf::setOpenMode(std::ios::openmode openMode)
{
d_openMode = openMode;
d_currentMode = openMode;
}
inline SharedMemory &SharedStreambuf::sharedMemory()
{
return d_memory;
}
} // FBB
#endif
|