|
|
|
@@ -58,7 +58,7 @@ Status Message2Operator::ParseOperatorAttrs(const google::protobuf::Message *mes |
|
|
|
return SUCCESS; |
|
|
|
} |
|
|
|
|
|
|
|
void Message2Operator::ParseBaseTypeField(const google::protobuf::Reflection *reflection, |
|
|
|
Status Message2Operator::ParseBaseTypeField(const google::protobuf::Reflection *reflection, |
|
|
|
const google::protobuf::Message *message, |
|
|
|
const google::protobuf::FieldDescriptor *field, ge::Operator &ops) { |
|
|
|
switch (field->cpp_type()) { |
|
|
|
@@ -93,16 +93,18 @@ void Message2Operator::ParseBaseTypeField(const google::protobuf::Reflection *re |
|
|
|
break; |
|
|
|
} |
|
|
|
default: { |
|
|
|
break; |
|
|
|
return FAILED; |
|
|
|
} |
|
|
|
} |
|
|
|
return SUCCESS; |
|
|
|
} |
|
|
|
|
|
|
|
Status Message2Operator::ParseField(const google::protobuf::Reflection *reflection, |
|
|
|
const google::protobuf::Message *message, |
|
|
|
const google::protobuf::FieldDescriptor *field, int depth, ge::Operator &ops) { |
|
|
|
GELOGD("Start to parse field: %s.", field->name().c_str()); |
|
|
|
ParseBaseTypeField(reflection, message, field, ops); |
|
|
|
GE_CHK_BOOL_RET_STATUS(ParseBaseTypeField(reflection, message, field, ops) == FAILED, SUCCESS, |
|
|
|
"Parse field: %s success.", field->name().c_str()); |
|
|
|
switch (field->cpp_type()) { |
|
|
|
case google::protobuf::FieldDescriptor::CPPTYPE_ENUM: { |
|
|
|
GE_CHECK_NOTNULL(reflection->GetEnum(*message, field)); |
|
|
|
@@ -136,7 +138,7 @@ Status Message2Operator::ParseField(const google::protobuf::Reflection *reflecti |
|
|
|
return SUCCESS; |
|
|
|
} |
|
|
|
|
|
|
|
void Message2Operator::ParseRepeatedBaseTypeField(const google::protobuf::Reflection *reflection, |
|
|
|
Status Message2Operator::ParseRepeatedBaseTypeField(const google::protobuf::Reflection *reflection, |
|
|
|
const google::protobuf::Message *message, |
|
|
|
const google::protobuf::FieldDescriptor *field, |
|
|
|
ge::Operator &ops, const int field_size) { |
|
|
|
@@ -196,9 +198,10 @@ void Message2Operator::ParseRepeatedBaseTypeField(const google::protobuf::Reflec |
|
|
|
break; |
|
|
|
} |
|
|
|
default: { |
|
|
|
break; |
|
|
|
return FAILED; |
|
|
|
} |
|
|
|
} |
|
|
|
return SUCCESS; |
|
|
|
} |
|
|
|
|
|
|
|
Status Message2Operator::ParseRepeatedField(const google::protobuf::Reflection *reflection, |
|
|
|
@@ -212,8 +215,8 @@ Status Message2Operator::ParseRepeatedField(const google::protobuf::Reflection * |
|
|
|
GELOGE(FAILED, "[Check][Size]Size of repeated field %s must bigger than 0", field->name().c_str()); |
|
|
|
return FAILED; |
|
|
|
} |
|
|
|
|
|
|
|
ParseRepeatedBaseTypeField(reflection, message, field, ops, field_size); |
|
|
|
GE_CHK_BOOL_RET_STATUS(ParseRepeatedBaseTypeField(reflection, message, field, ops, field_size) == FAILED, SUCCESS, |
|
|
|
"Parse repeated field: %s success.", field->name().c_str()); |
|
|
|
switch (field->cpp_type()) { |
|
|
|
case google::protobuf::FieldDescriptor::CPPTYPE_MESSAGE: { |
|
|
|
nlohmann::json message_json; |
|
|
|
|