/usr/include/bobcat/sharedpos 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 | #ifndef INCLUDED_BOBCAT_SHAREDPOS_
#define INCLUDED_BOBCAT_SHAREDPOS_
#include <iosfwd>
#include <ios>
#include <bobcat/sharedsegment>
namespace FBB
{
class SharedPos
{
friend std::ostream &operator<<(std::ostream &out, SharedPos const &pos);
SharedSegment *d_sharedData = 0; // setup must have been called to
// initialize data members
std::streamsize d_maxOffset = 0; // max. possible offset, given nBlocks
std::streamsize d_offset = 0; // next location to write
size_t d_blockIdx = 0;
size_t d_blockOffset = 0;
public:
bool atMaxOffset() const;
size_t blockIdx() const;
size_t blockOffset() const;
bool eof() const; // true if no char can be read
// because offset >= writeoffset
std::streamsize eos() const; // abs. offset just past
// block[blockIdx()]
std::streamsize maxOffset() const; // abs. max. possible offset
std::streamsize offset() const; // current abs. offset
void reset(SharedSegment *sharedData);
// returns -1 if inaccessible
std::ios::pos_type seek(std::ios::off_type offset,
std::ios::seekdir way = std::ios::beg);
std::streamsize showmanyc() const;
void operator++(); // caller must have locked the shared
// data
void operator+=(size_t len); // caller must have locked the shared
// data
private:
std::ostream &insert(std::ostream &out) const;
size_t segmentSize() const;
void update();
std::streamsize nReadable() const;
};
inline bool SharedPos::atMaxOffset() const
{
return d_offset == d_maxOffset;
}
inline size_t SharedPos::blockIdx() const
{
return d_blockIdx;
}
inline size_t SharedPos::blockOffset() const
{
return d_blockOffset;
}
inline bool SharedPos::eof() const
{
return d_offset >= d_sharedData->nReadable();
}
inline std::streamsize SharedPos::eos() const
{
return static_cast<std::streamsize>(blockIdx() + 1) * segmentSize();
}
inline std::streamsize SharedPos::maxOffset() const
{
return d_maxOffset;
}
inline std::streamsize SharedPos::nReadable() const
{
return d_sharedData->nReadable();
}
inline std::streamsize SharedPos::offset() const
{
return d_offset;
}
inline std::ostream &operator<<(std::ostream &out, SharedPos const &sharedPos)
{
return sharedPos.insert(out);
}
inline size_t SharedPos::segmentSize() const
{
return d_sharedData->segmentSize();
}
} // FBB
#endif
|