MCPcopy Create free account
hub / github.com/apache/madlib / ByteStream

Class ByteStream

src/dbal/ByteStream_proto.hpp:33–84  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

31 template <class T> class TypeTraits = ByteStreamDefaultTypeTraits,
32 bool IsMutable = StreamBuf::isMutable>
33class ByteStream {
34public:
35 typedef StreamBuf StreamBuf_type;
36 typedef typename StreamBuf_type::char_type char_type;
37 enum { isMutable = IsMutable };
38 enum { maximumAlignment =
39 TypeTraits<ByteStreamMaximumAlignmentType>::alignment };
40
41 friend class DryRun;
42
43 class DryRun {
44 public:
45 DryRun(ByteStream& inStream);
46 ~DryRun();
47 void leave();
48
49 protected:
50 ByteStream& mStream;
51 bool mIsIn;
52 };
53
54 ByteStream(StreamBuf_type* inStreamBuf);
55
56 template <size_t Alignment> size_t seek(std::ptrdiff_t inOffset,
57 std::ios_base::seekdir inDir);
58 size_t seek(size_t inPos);
59 size_t seek(std::ptrdiff_t inOffset, std::ios_base::seekdir inDir);
60 size_t available() const;
61 const char_type* ptr() const;
62 size_t size() const;
63 size_t tell() const;
64 std::ios_base::iostate rdstate() const;
65 bool eof() const;
66 bool isInDryRun() const;
67 template <class T> const T* read(size_t inCount = 1);
68
69protected:
70 void enterDryRun();
71 void leaveDryRun();
72
73 /**
74 * @brief The associated storage to the stream (similar to a streambuf for
75 * IOStreams)
76 */
77 StreamBuf_type* mStreamBuf;
78
79 /**
80 * @brief In dry mode read/write operations will only move the cursor, but
81 * other objects are not touched
82 */
83 int32_t mDryRun;
84};
85
86template <class StreamBuf, template <class T> class TypeTraits>
87class ByteStream<StreamBuf, TypeTraits, Mutable>

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected