MiniOB 1
MiniOB is one mini database, helping developers to learn how database works.
载入中...
搜索中...
未找到
Public 成员函数 | 静态 Public 成员函数 | Protected 属性 | 静态 Protected 属性 | 所有成员列表
DataType类 参考
类 DataType 继承关系图:
CharType FloatType IntegerType VectorType

Public 成员函数

 DataType (AttrType attr_type)
 
AttrType get_attr_type () const
 
virtual int compare (const Value &left, const Value &right) const
 
virtual RC add (const Value &left, const Value &right, Value &result) const
 计算 left + right,并将结果保存到 result 中 更多...
 
virtual RC subtract (const Value &left, const Value &right, Value &result) const
 计算 left - right,并将结果保存到 result 中 更多...
 
virtual RC multiply (const Value &left, const Value &right, Value &result) const
 计算 left * right,并将结果保存到 result 中 更多...
 
virtual RC divide (const Value &left, const Value &right, Value &result) const
 计算 left / right,并将结果保存到 result 中 更多...
 
virtual RC negative (const Value &val, Value &result) const
 计算 -val,并将结果保存到 result 中 更多...
 
virtual RC cast_to (const Value &val, AttrType type, Value &result) const
 将 val 转换为 type 类型,并将结果保存到 result 中 更多...
 
virtual RC to_string (const Value &val, string &result) const
 将 val 转换为 string,并将结果保存到 result 中 更多...
 
virtual int cast_cost (AttrType type)
 计算从 type 到 attr_type 的隐式转换的 cost,如果无法转换,返回 INT32_MAX 更多...
 
virtual RC set_value_from_str (Value &val, const string &data) const
 

静态 Public 成员函数

static DataTypetype_instance (AttrType attr_type)
 

Protected 属性

AttrType attr_type_
 

静态 Protected 属性

static array< unique_ptr< DataType >, static_cast< int >(AttrType::MAXTYPE)> type_instances_
 

成员函数说明

◆ add()

virtual RC DataType::add ( const Value left,
const Value right,
Value result 
) const
inlinevirtual

计算 left + right,并将结果保存到 result 中

FloatType, IntegerType , 以及 VectorType 重载.

◆ cast_cost()

virtual int DataType::cast_cost ( AttrType  type)
inlinevirtual

计算从 type 到 attr_type 的隐式转换的 cost,如果无法转换,返回 INT32_MAX

CharType 重载.

◆ cast_to()

virtual RC DataType::cast_to ( const Value val,
AttrType  type,
Value result 
) const
inlinevirtual

将 val 转换为 type 类型,并将结果保存到 result 中

CharType 重载.

◆ compare()

virtual int DataType::compare ( const Value left,
const Value right 
) const
inlinevirtual
返回
-1 表示 left < right 0 表示 left = right 1 表示 left > right INT32_MAX 表示未实现的比较

CharType, FloatType, IntegerType , 以及 VectorType 重载.

◆ divide()

virtual RC DataType::divide ( const Value left,
const Value right,
Value result 
) const
inlinevirtual

计算 left / right,并将结果保存到 result 中

FloatType 重载.

◆ multiply()

virtual RC DataType::multiply ( const Value left,
const Value right,
Value result 
) const
inlinevirtual

计算 left * right,并将结果保存到 result 中

FloatType, IntegerType , 以及 VectorType 重载.

◆ negative()

virtual RC DataType::negative ( const Value val,
Value result 
) const
inlinevirtual

计算 -val,并将结果保存到 result 中

FloatType , 以及 IntegerType 重载.

◆ subtract()

virtual RC DataType::subtract ( const Value left,
const Value right,
Value result 
) const
inlinevirtual

计算 left - right,并将结果保存到 result 中

FloatType, IntegerType , 以及 VectorType 重载.

◆ to_string()

virtual RC DataType::to_string ( const Value val,
string &  result 
) const
inlinevirtual

将 val 转换为 string,并将结果保存到 result 中

CharType, FloatType, IntegerType , 以及 VectorType 重载.

类成员变量说明

◆ type_instances_

array< unique_ptr< DataType >, static_cast< int >(AttrType::MAXTYPE)> DataType::type_instances_
staticprotected
初始值:
= {
make_unique<DataType>(AttrType::UNDEFINED),
make_unique<CharType>(),
make_unique<IntegerType>(),
make_unique<FloatType>(),
make_unique<VectorType>(),
make_unique<DataType>(AttrType::BOOLEANS),
}

该类的文档由以下文件生成: