|
|
|
@@ -79,61 +79,65 @@ OpSchema &OpSchema::Attr(const Attribute &attr) { |
|
|
|
#endif |
|
|
|
|
|
|
|
#if defined(CFG_BUILD_DEBUG) |
|
|
|
#define ATTR_SETTER_WITH_LIST_VALUE(Type, field, attrtype) \ |
|
|
|
OpSchema &OpSchema::Attr(const std::string &name, AttributeType attr_type, const std::vector<Type> &default_value) { \ |
|
|
|
if (attrtype != attr_type) { \ |
|
|
|
REPORT_INNER_ERROR("E19999", "Attribute specification vector param_type mismatch, " \ |
|
|
|
"input attr type %u, required attr type %u.", (uint32_t)attr_type, (uint32_t)attrtype); \ |
|
|
|
GELOGE(FAILED, "[Check][Param]Attribute specification vector param_type mismatch, " \ |
|
|
|
"input attr type %u, required attr type %u.", (uint32_t)attr_type, (uint32_t)attrtype); \ |
|
|
|
return *this; \ |
|
|
|
} \ |
|
|
|
domi::AttrDef vec_a; \ |
|
|
|
for (const auto &v : default_value) { \ |
|
|
|
vec_a.mutable_list()->add_##field(v); \ |
|
|
|
} \ |
|
|
|
Attr(Attribute(name, attr_type, vec_a)); \ |
|
|
|
return *this; \ |
|
|
|
} \ |
|
|
|
OpSchema &OpSchema::Attr(const std::string &name, AttributeType attr_type, const Tuple<Type> &default_value) { \ |
|
|
|
if (attrtype != attr_type) { \ |
|
|
|
REPORT_INNER_ERROR("E19999", "Attribute specification vector param_type mismatch, " \ |
|
|
|
"input attr type %u, required attr type %u.", (uint32_t)attr_type, (uint32_t)attrtype); \ |
|
|
|
GELOGE(FAILED, "[Check][Param]Attribute specification vector param_type mismatch, " \ |
|
|
|
"input attr type %u, required attr type %u.", (uint32_t)attr_type, (uint32_t)attrtype); \ |
|
|
|
return *this; \ |
|
|
|
} \ |
|
|
|
domi::AttrDef tuple_a; \ |
|
|
|
for (const auto &v : default_value) { \ |
|
|
|
tuple_a.mutable_list()->add_##field(v); \ |
|
|
|
} \ |
|
|
|
Attr(Attribute(name, attr_type, tuple_a)); \ |
|
|
|
return *this; \ |
|
|
|
} |
|
|
|
#define ATTR_SETTER_WITH_LIST_VALUE(Type, field, attrtype) \ |
|
|
|
do { \ |
|
|
|
OpSchema &OpSchema::Attr(const std::string &name, AttributeType attr_type, const std::vector<Type> &default_value) { \ |
|
|
|
if (attrtype != attr_type) { \ |
|
|
|
REPORT_INNER_ERROR("E19999", "Attribute specification vector param_type mismatch, " \ |
|
|
|
"input attr type %u, required attr type %u.", (uint32_t)attr_type, (uint32_t)attrtype); \ |
|
|
|
GELOGE(FAILED, "[Check][Param]Attribute specification vector param_type mismatch, " \ |
|
|
|
"input attr type %u, required attr type %u.", (uint32_t)attr_type, (uint32_t)attrtype); \ |
|
|
|
return *this; \ |
|
|
|
} \ |
|
|
|
domi::AttrDef vec_a; \ |
|
|
|
for (const auto &v : default_value) { \ |
|
|
|
vec_a.mutable_list()->add_##field(v); \ |
|
|
|
} \ |
|
|
|
Attr(Attribute(name, attr_type, vec_a)); \ |
|
|
|
return *this; \ |
|
|
|
} \ |
|
|
|
OpSchema &OpSchema::Attr(const std::string &name, AttributeType attr_type, const Tuple<Type> &default_value) { \ |
|
|
|
if (attrtype != attr_type) { \ |
|
|
|
REPORT_INNER_ERROR("E19999", "Attribute specification vector param_type mismatch, " \ |
|
|
|
"input attr type %u, required attr type %u.", (uint32_t)attr_type, (uint32_t)attrtype); \ |
|
|
|
GELOGE(FAILED, "[Check][Param]Attribute specification vector param_type mismatch, " \ |
|
|
|
"input attr type %u, required attr type %u.", (uint32_t)attr_type, (uint32_t)attrtype); \ |
|
|
|
return *this; \ |
|
|
|
} \ |
|
|
|
domi::AttrDef tuple_a; \ |
|
|
|
for (const auto &v : default_value) { \ |
|
|
|
tuple_a.mutable_list()->add_##field(v); \ |
|
|
|
} \ |
|
|
|
Attr(Attribute(name, attr_type, tuple_a)); \ |
|
|
|
return *this; \ |
|
|
|
} \ |
|
|
|
} while (0) |
|
|
|
#else |
|
|
|
#define ATTR_SETTER_WITH_LIST_VALUE(Type, field, attrtype) \ |
|
|
|
OpSchema &OpSchema::Attr(const std::string &name, AttributeType attr_type, const std::vector<Type> &default_value) { \ |
|
|
|
if (attrtype != attr_type) { \ |
|
|
|
return *this; \ |
|
|
|
} \ |
|
|
|
domi::AttrDef vec_a; \ |
|
|
|
for (const auto &v : default_value) { \ |
|
|
|
vec_a.mutable_list()->add_##field(v); \ |
|
|
|
} \ |
|
|
|
Attr(Attribute(name, attr_type, vec_a)); \ |
|
|
|
return *this; \ |
|
|
|
} \ |
|
|
|
OpSchema &OpSchema::Attr(const std::string &name, AttributeType attr_type, const Tuple<Type> &default_value) { \ |
|
|
|
if (attrtype != attr_type) { \ |
|
|
|
return *this; \ |
|
|
|
} \ |
|
|
|
domi::AttrDef tuple_a; \ |
|
|
|
for (const auto &v : default_value) { \ |
|
|
|
tuple_a.mutable_list()->add_##field(v); \ |
|
|
|
} \ |
|
|
|
Attr(Attribute(name, attr_type, tuple_a)); \ |
|
|
|
return *this; \ |
|
|
|
} |
|
|
|
#define ATTR_SETTER_WITH_LIST_VALUE(Type, field, attrtype) \ |
|
|
|
do { \ |
|
|
|
OpSchema &OpSchema::Attr(const std::string &name, AttributeType attr_type, const std::vector<Type> &default_value) { \ |
|
|
|
if (attrtype != attr_type) { \ |
|
|
|
return *this; \ |
|
|
|
} \ |
|
|
|
domi::AttrDef vec_a; \ |
|
|
|
for (const auto &v : default_value) { \ |
|
|
|
vec_a.mutable_list()->add_##field(v); \ |
|
|
|
} \ |
|
|
|
Attr(Attribute(name, attr_type, vec_a)); \ |
|
|
|
return *this; \ |
|
|
|
} \ |
|
|
|
OpSchema &OpSchema::Attr(const std::string &name, AttributeType attr_type, const Tuple<Type> &default_value) { \ |
|
|
|
if (attrtype != attr_type) { \ |
|
|
|
return *this; \ |
|
|
|
} \ |
|
|
|
domi::AttrDef tuple_a; \ |
|
|
|
for (const auto &v : default_value) { \ |
|
|
|
tuple_a.mutable_list()->add_##field(v); \ |
|
|
|
} \ |
|
|
|
Attr(Attribute(name, attr_type, tuple_a)); \ |
|
|
|
return *this; \ |
|
|
|
} \ |
|
|
|
} while (0) |
|
|
|
|
|
|
|
#endif |
|
|
|
ATTR_SETTER_WITH_SINGLE_VALUE(uint32_t, u, AttributeType::UINT) |
|
|
|
|