未验证 提交 9f269387 编写于 作者: H huzhiqiang 提交者: GitHub

[Windows compile] change core/types name to avoid corruption on windows (#3377)

上级 19e4987c
...@@ -67,31 +67,31 @@ STL::ostream& operator<<(STL::ostream& os, const KernelPickFactor& k) { ...@@ -67,31 +67,31 @@ STL::ostream& operator<<(STL::ostream& os, const KernelPickFactor& k) {
template <> template <>
Type StdTypeToRepr<int32_t>() { Type StdTypeToRepr<int32_t>() {
return Type::_int32; return Type::INT32;
} }
template <> template <>
Type StdTypeToRepr<int64_t>() { Type StdTypeToRepr<int64_t>() {
return Type::_int64; return Type::INT64;
} }
template <> template <>
Type StdTypeToRepr<float>() { Type StdTypeToRepr<float>() {
return Type::_float32; return Type::FLOAT32;
} }
template <> template <>
Type StdTypeToRepr<double>() { Type StdTypeToRepr<double>() {
return Type::_float64; return Type::Float64;
} }
template <> template <>
Type StdTypeToRepr<std::vector<char>>() { Type StdTypeToRepr<std::vector<char>>() {
return Type::_char_list; return Type::CHARLIST;
} }
template <> template <>
Type StdTypeToRepr<std::string>() { Type StdTypeToRepr<std::string>() {
return Type::_string; return Type::STRING;
} }
template <> template <>
Type StdTypeToRepr<bool>() { Type StdTypeToRepr<bool>() {
return Type::_bool; return Type::BOOL;
} }
} // namespace core } // namespace core
......
...@@ -29,23 +29,23 @@ namespace core { ...@@ -29,23 +29,23 @@ namespace core {
*/ */
// TODO(Superjomn) unify all the type representation across the lite framework. // TODO(Superjomn) unify all the type representation across the lite framework.
enum class Type { enum class Type {
_unk = -1, UNK = -1,
// primary types // primary types
_int32, INT32,
_int64, INT64,
_float32, FLOAT32,
_float64, Float64,
_bool, BOOL,
_string, STRING,
// primary list type // primary list type
_char_list, CHARLIST,
// list types // list types
_list, LIST,
// enum type // enum type
_enum, ENUM,
_float16, FLOAT16,
// number of types // number of types
__num__, NUM,
}; };
enum class FluidType { enum class FluidType {
...@@ -81,7 +81,7 @@ enum class FluidType { ...@@ -81,7 +81,7 @@ enum class FluidType {
template <typename T> template <typename T>
Type StdTypeToRepr() { Type StdTypeToRepr() {
return Type::_unk; return Type::UNK;
} }
template <> template <>
Type StdTypeToRepr<int32_t>(); Type StdTypeToRepr<int32_t>();
......
...@@ -192,7 +192,7 @@ class EnumBuilder : public FieldBuilder { ...@@ -192,7 +192,7 @@ class EnumBuilder : public FieldBuilder {
~EnumBuilder() = default; ~EnumBuilder() = default;
Type type() const override { return Type::_enum; } Type type() const override { return Type::ENUM; }
}; };
class StringBuilder : public FieldBuilder { class StringBuilder : public FieldBuilder {
...@@ -211,7 +211,7 @@ class StringBuilder : public FieldBuilder { ...@@ -211,7 +211,7 @@ class StringBuilder : public FieldBuilder {
void Load() override; void Load() override;
Type type() const override { return Type::_string; } Type type() const override { return Type::STRING; }
}; };
/* /*
...@@ -266,7 +266,7 @@ class StructBuilder : public FieldBuilder { ...@@ -266,7 +266,7 @@ class StructBuilder : public FieldBuilder {
/// Type of this struct. /// Type of this struct.
// TODO(Superjomn) The customized type is not supported yet. // TODO(Superjomn) The customized type is not supported yet.
Type type() const override { return Type::_unk; } Type type() const override { return Type::UNK; }
/// Get a field by `name`. /// Get a field by `name`.
template <typename T> template <typename T>
...@@ -327,7 +327,7 @@ class ListBuilder : public FieldBuilder { ...@@ -327,7 +327,7 @@ class ListBuilder : public FieldBuilder {
} }
// Get element type. // Get element type.
Type type() const override { return Type::_list; } Type type() const override { return Type::LIST; }
/// Persist information to the corresponding BinaryTable. /// Persist information to the corresponding BinaryTable.
void Save() override; void Save() override;
......
...@@ -24,9 +24,9 @@ TEST(NaiveBuffer, primary) { ...@@ -24,9 +24,9 @@ TEST(NaiveBuffer, primary) {
PrimaryBuilder<int32_t> p0(&table); PrimaryBuilder<int32_t> p0(&table);
PrimaryBuilder<float> p1(&table); PrimaryBuilder<float> p1(&table);
StringBuilder p2(&table); StringBuilder p2(&table);
ASSERT_EQ(p0.type(), Type::_int32); ASSERT_EQ(p0.type(), Type::INT32);
ASSERT_EQ(p1.type(), Type::_float32); ASSERT_EQ(p1.type(), Type::FLOAT32);
ASSERT_EQ(p2.type(), Type::_string); ASSERT_EQ(p2.type(), Type::STRING);
p0.set(2008); p0.set(2008);
p0.Save(); p0.Save();
...@@ -129,7 +129,7 @@ TEST(NBTestMsg, msg1) { ...@@ -129,7 +129,7 @@ TEST(NBTestMsg, msg1) {
int0->set(2008); int0->set(2008);
int0->Save(); int0->Save();
enum0->set(Type::_int64); enum0->set(Type::INT64);
enum0->Save(); enum0->Save();
SetMsg0(msg0); SetMsg0(msg0);
...@@ -143,7 +143,7 @@ TEST(NBTestMsg, msg1) { ...@@ -143,7 +143,7 @@ TEST(NBTestMsg, msg1) {
msg1.Load(); msg1.Load();
ASSERT_EQ(msg.GetField<Int32Builder>("int0").data(), 2008); ASSERT_EQ(msg.GetField<Int32Builder>("int0").data(), 2008);
ASSERT_EQ(msg.GetField<enum_builder>("enum0").data(), Type::_int64); ASSERT_EQ(msg.GetField<enum_builder>("enum0").data(), Type::INT64);
TestMsg0(msg1.GetField<NBTestMsg0>("msg0")); TestMsg0(msg1.GetField<NBTestMsg0>("msg0"));
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册