MiniOB 1
MiniOB is one mini database, helping developers to learn how database works.
载入中...
搜索中...
未找到
float_type.h
1/* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved.
2miniob is licensed under Mulan PSL v2.
3You can use this software according to the terms and conditions of the Mulan PSL v2.
4You may obtain a copy of Mulan PSL v2 at:
5 http://license.coscl.org.cn/MulanPSL2
6THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
7EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
8MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
9See the Mulan PSL v2 for more details. */
10
11#pragma once
12
13#include "common/type/data_type.h"
14
19class FloatType : public DataType
20{
21public:
22 FloatType() : DataType(AttrType::FLOATS) {}
23 virtual ~FloatType() = default;
24
25 int compare(const Value &left, const Value &right) const override;
26
27 RC add(const Value &left, const Value &right, Value &result) const override;
28 RC subtract(const Value &left, const Value &right, Value &result) const override;
29 RC multiply(const Value &left, const Value &right, Value &result) const override;
30 RC divide(const Value &left, const Value &right, Value &result) const override;
31 RC negative(const Value &val, Value &result) const override;
32
33 RC set_value_from_str(Value &val, const string &data) const override;
34
35 RC to_string(const Value &val, string &result) const override;
36};
Definition: data_type.h:28
浮点型数据类型
Definition: float_type.h:20
RC negative(const Value &val, Value &result) const override
计算 -val,并将结果保存到 result 中
Definition: float_type.cpp:56
int compare(const Value &left, const Value &right) const override
Definition: float_type.cpp:19
RC subtract(const Value &left, const Value &right, Value &result) const override
计算 left - right,并将结果保存到 result 中
Definition: float_type.cpp:33
RC to_string(const Value &val, string &result) const override
将 val 转换为 string,并将结果保存到 result 中
Definition: float_type.cpp:79
RC add(const Value &left, const Value &right, Value &result) const override
计算 left + right,并将结果保存到 result 中
Definition: float_type.cpp:28
RC multiply(const Value &left, const Value &right, Value &result) const override
计算 left * right,并将结果保存到 result 中
Definition: float_type.cpp:38
RC divide(const Value &left, const Value &right, Value &result) const override
计算 left / right,并将结果保存到 result 中
Definition: float_type.cpp:44
属性的值
Definition: value.h:30