1 /*
2  * Copyright (c) 2022 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #ifndef RELATIONAL_ROW_DATA_IMPL_H
17 #define RELATIONAL_ROW_DATA_IMPL_H
18 
19 #include "data_transformer.h"
20 #include "relational_row_data.h"
21 
22 namespace DistributedDB {
23 class RelationalRowDataImpl : public RelationalRowData {
24 public:
25     RelationalRowDataImpl() = default;
RelationalRowDataImpl(RowData && rowData)26     explicit RelationalRowDataImpl(RowData &&rowData) : data_(std::move(rowData)) {}
~RelationalRowDataImpl()27     ~RelationalRowDataImpl() override {}
28 
29     std::size_t GetColSize() override;
30 
31     int CalcLength() const override;
32     int Serialize(Parcel &parcel) const override;
33     int DeSerialize(Parcel &parcel) override;
34 
35     int GetType(int index, StorageType &type) const override;
36     int Get(int index, int64_t &value) const override;
37     int Get(int index, double &value) const override;
38     int Get(int index, std::string &value) const override;
39     int Get(int index, std::vector<uint8_t> &value) const override;
40 
41 private:
42     RowData data_;
43 };
44 }  // namespace DistributedDB
45 #endif  // RELATIONAL_ROW_DATA_IMPL_H