3 #ifndef STREAMBASE_TUPLE_LIST_H
4 #define STREAMBASE_TUPLE_LIST_H
36 const Schema& getSchema()
const;
39 void setSchema(
const Schema& schema);
43 size_t getSize()
const;
44 size_t size()
const {
return getSize(); }
50 void resize(
size_t size) { setSize(size); }
51 void setSize(
size_t size);
60 bool empty()
const {
return size() == 0; }
64 const Tuple& operator[] (
size_t index)
const;
67 Tuple& operator[] (
size_t index);
70 void push_back(
const Tuple& r);
75 const Tuple& back()
const;
79 typedef std::vector<Tuple>::iterator iterator;
80 typedef std::vector<Tuple>::const_iterator const_iterator;
86 const_iterator begin()
const;
87 const_iterator end()
const;
91 #ifndef DOXYGEN_INTERNAL_ONLY
104 size_t copyIntoBuffer(
char* buf,
size_t len,
bool byteswap)
const;
105 static TupleList createFromPackedBuffer(
size_t* size_used,
106 const char* buf,
size_t buf_len,
bool byteswap,
const Schema& s,
107 size_t expect_num_tuples = (
size_t)-1);
108 static TupleList createRawFromPackedBuffer(
size_t* size_used,
109 const char* buf,
size_t buf_len,
bool byteswap,
const Schema& s,
110 size_t expect_num_tuples = (
size_t)-1);
112 const std::string getRawBits()
const {
return _->rawBits; }
113 void setRawBits(
const char *bits,
const size_t len) { _->rawBits.assign(bits, len); }
119 std::string as_string()
const;
122 struct TupleListPrivateImpl {
124 std::vector<Tuple> tuples;
127 TupleListPrivateImpl() { }
128 TupleListPrivateImpl(
const TupleListPrivateImpl& t) :
129 schema(t.schema), tuples(t.tuples), rawBits(t.rawBits) { }
132 std::shared_ptr<TupleListPrivateImpl> _;
137 void ensureAllocated()
const;
142 inline std::ostream& operator << (std::ostream& os,
const sb::TupleList& tl) {