diff --git a/lite/core/types.cc b/lite/core/types.cc index 4ea383333d519ac2c481dce459ca49124a64df32..a19c5ed0a33986237ce03213875929d34a2fb363 100644 --- a/lite/core/types.cc +++ b/lite/core/types.cc @@ -67,31 +67,31 @@ STL::ostream& operator<<(STL::ostream& os, const KernelPickFactor& k) { template <> Type StdTypeToRepr() { - return Type::_int32; + return Type::INT32; } template <> Type StdTypeToRepr() { - return Type::_int64; + return Type::INT64; } template <> Type StdTypeToRepr() { - return Type::_float32; + return Type::FLOAT32; } template <> Type StdTypeToRepr() { - return Type::_float64; + return Type::Float64; } template <> Type StdTypeToRepr>() { - return Type::_char_list; + return Type::CHARLIST; } template <> Type StdTypeToRepr() { - return Type::_string; + return Type::STRING; } template <> Type StdTypeToRepr() { - return Type::_bool; + return Type::BOOL; } } // namespace core diff --git a/lite/core/types.h b/lite/core/types.h index 8f154f9dd509d3627750ecbf301923a2296252d1..db7d51175811c589dd892e4d5a619721dc2e3710 100644 --- a/lite/core/types.h +++ b/lite/core/types.h @@ -29,23 +29,23 @@ namespace core { */ // TODO(Superjomn) unify all the type representation across the lite framework. enum class Type { - _unk = -1, + UNK = -1, // primary types - _int32, - _int64, - _float32, - _float64, - _bool, - _string, + INT32, + INT64, + FLOAT32, + Float64, + BOOL, + STRING, // primary list type - _char_list, + CHARLIST, // list types - _list, + LIST, // enum type - _enum, - _float16, + ENUM, + FLOAT16, // number of types - __num__, + NUM, }; enum class FluidType { @@ -81,7 +81,7 @@ enum class FluidType { template Type StdTypeToRepr() { - return Type::_unk; + return Type::UNK; } template <> Type StdTypeToRepr(); diff --git a/lite/model_parser/naive_buffer/naive_buffer.h b/lite/model_parser/naive_buffer/naive_buffer.h index 5be17856a25aabfed81ae88d80e788c8dd2be4bc..5fd1b59e151cf834f87aa4e505be029b2b0d899a 100644 --- a/lite/model_parser/naive_buffer/naive_buffer.h +++ b/lite/model_parser/naive_buffer/naive_buffer.h @@ -192,7 +192,7 @@ class EnumBuilder : public FieldBuilder { ~EnumBuilder() = default; - Type type() const override { return Type::_enum; } + Type type() const override { return Type::ENUM; } }; class StringBuilder : public FieldBuilder { @@ -211,7 +211,7 @@ class StringBuilder : public FieldBuilder { 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 { /// Type of this struct. // 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`. template @@ -327,7 +327,7 @@ class ListBuilder : public FieldBuilder { } // Get element type. - Type type() const override { return Type::_list; } + Type type() const override { return Type::LIST; } /// Persist information to the corresponding BinaryTable. void Save() override; diff --git a/lite/model_parser/naive_buffer/naive_buffer_test.cc b/lite/model_parser/naive_buffer/naive_buffer_test.cc index 98789e8006817fceb4745bffd0c095da7ad360fc..7356c6213c3b1c85e63fed604f22652d780a369f 100644 --- a/lite/model_parser/naive_buffer/naive_buffer_test.cc +++ b/lite/model_parser/naive_buffer/naive_buffer_test.cc @@ -24,9 +24,9 @@ TEST(NaiveBuffer, primary) { PrimaryBuilder p0(&table); PrimaryBuilder p1(&table); StringBuilder p2(&table); - ASSERT_EQ(p0.type(), Type::_int32); - ASSERT_EQ(p1.type(), Type::_float32); - ASSERT_EQ(p2.type(), Type::_string); + ASSERT_EQ(p0.type(), Type::INT32); + ASSERT_EQ(p1.type(), Type::FLOAT32); + ASSERT_EQ(p2.type(), Type::STRING); p0.set(2008); p0.Save(); @@ -129,7 +129,7 @@ TEST(NBTestMsg, msg1) { int0->set(2008); int0->Save(); - enum0->set(Type::_int64); + enum0->set(Type::INT64); enum0->Save(); SetMsg0(msg0); @@ -143,7 +143,7 @@ TEST(NBTestMsg, msg1) { msg1.Load(); ASSERT_EQ(msg.GetField("int0").data(), 2008); - ASSERT_EQ(msg.GetField("enum0").data(), Type::_int64); + ASSERT_EQ(msg.GetField("enum0").data(), Type::INT64); TestMsg0(msg1.GetField("msg0")); }