/usr/include/bobcat/sharedstreambuf is in libbobcat-dev 3.19.01-1ubuntu1.
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 | #ifndef INCLUDED_BOBCAT_SHAREDSTREAMBUF_
#define INCLUDED_BOBCAT_SHAREDSTREAMBUF_
#include <ios>
#include <streambuf>
#include <bobcat/sharedmemory>
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();
int id() const; // id of the shared Memory segment
void kill(); // kill all shared segments w/o locks
// the object is unusable hereafter
void remove(); // remove all shared segments.
// the object is unusable hereafter
void clear(); // clear all existing data and reduce
// until only the segment at
// d_sharedData
void setMemory(SharedMemory &&tmp);
void memInfo(std::ostream &out) const;
protected:
void setOpenMode(std::ios::openmode openMode);
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::setOpenMode(std::ios::openmode openMode)
{
d_openMode = openMode;
d_currentMode = openMode;
}
inline int SharedStreambuf::id() const
{
return d_memory.id();
}
inline void SharedStreambuf::remove()
{
d_memory.remove();
}
inline void SharedStreambuf::kill()
{
d_memory.kill();
}
inline void SharedStreambuf::clear()
{
d_memory.clear();
}
inline void SharedStreambuf::setMemory(SharedMemory &&tmp)
{
d_memory = std::move(tmp);
}
inline void SharedStreambuf::memInfo(std::ostream &out) const
{
out << d_memory;
}
} // FBB
#endif
|