2121#define ENCODING_DECODER_H
2222
2323#include " common/allocator/byte_stream.h"
24- #include " common/db_common.h"
2524
2625namespace storage {
2726
@@ -38,102 +37,6 @@ class Decoder {
3837 virtual int read_double (double & ret_value, common::ByteStream& in) = 0;
3938 virtual int read_String (common::String& ret_value, common::PageArena& pa,
4039 common::ByteStream& in) = 0;
41-
42- virtual int read_batch_int32 (int32_t * out, int capacity, int & actual,
43- common::ByteStream& in) {
44- actual = 0 ;
45- int ret = common::E_OK;
46- int32_t val;
47- while (actual < capacity && has_remaining (in)) {
48- ret = read_int32 (val, in);
49- if (ret != common::E_OK) return ret;
50- out[actual++] = val;
51- }
52- return common::E_OK;
53- }
54-
55- virtual int read_batch_int64 (int64_t * out, int capacity, int & actual,
56- common::ByteStream& in) {
57- actual = 0 ;
58- int ret = common::E_OK;
59- int64_t val;
60- while (actual < capacity && has_remaining (in)) {
61- ret = read_int64 (val, in);
62- if (ret != common::E_OK) return ret;
63- out[actual++] = val;
64- }
65- return common::E_OK;
66- }
67-
68- virtual int read_batch_float (float * out, int capacity, int & actual,
69- common::ByteStream& in) {
70- actual = 0 ;
71- int ret = common::E_OK;
72- float val;
73- while (actual < capacity && has_remaining (in)) {
74- ret = read_float (val, in);
75- if (ret != common::E_OK) return ret;
76- out[actual++] = val;
77- }
78- return common::E_OK;
79- }
80-
81- virtual int read_batch_double (double * out, int capacity, int & actual,
82- common::ByteStream& in) {
83- actual = 0 ;
84- int ret = common::E_OK;
85- double val;
86- while (actual < capacity && has_remaining (in)) {
87- ret = read_double (val, in);
88- if (ret != common::E_OK) return ret;
89- out[actual++] = val;
90- }
91- return common::E_OK;
92- }
93-
94- virtual int skip_int32 (int count, int & skipped, common::ByteStream& in) {
95- skipped = 0 ;
96- int32_t dummy;
97- while (skipped < count && has_remaining (in)) {
98- int ret = read_int32 (dummy, in);
99- if (ret != common::E_OK) return ret;
100- ++skipped;
101- }
102- return common::E_OK;
103- }
104-
105- virtual int skip_int64 (int count, int & skipped, common::ByteStream& in) {
106- skipped = 0 ;
107- int64_t dummy;
108- while (skipped < count && has_remaining (in)) {
109- int ret = read_int64 (dummy, in);
110- if (ret != common::E_OK) return ret;
111- ++skipped;
112- }
113- return common::E_OK;
114- }
115-
116- virtual int skip_float (int count, int & skipped, common::ByteStream& in) {
117- skipped = 0 ;
118- float dummy;
119- while (skipped < count && has_remaining (in)) {
120- int ret = read_float (dummy, in);
121- if (ret != common::E_OK) return ret;
122- ++skipped;
123- }
124- return common::E_OK;
125- }
126-
127- virtual int skip_double (int count, int & skipped, common::ByteStream& in) {
128- skipped = 0 ;
129- double dummy;
130- while (skipped < count && has_remaining (in)) {
131- int ret = read_double (dummy, in);
132- if (ret != common::E_OK) return ret;
133- ++skipped;
134- }
135- return common::E_OK;
136- }
13740};
13841
13942} // end namespace storage
0 commit comments