Parameter Types#
IParameter#
-
class IParameter#
Subclassed by aidi::param::SchemableParameter
ISchemable#
-
struct ISchemable#
Json Schemable Class API.
A Json Schemable Class is a class that can be serialized to/deserialized from Json and can be validated by Json Schema.
Subclassed by aidi::param::SchemableParameter
Public Functions
-
virtual std::string json_schema() const = 0#
Get the json schema of the class.
- Returns:
std::string the json schema string.
-
virtual aidi::Buffer to_json() const = 0#
Serialize the parameter group to schema-validatable json string.
- Returns:
aidi::Buffer the schema-validatable json string.
-
virtual ISchemable &from_json(const aidi::Buffer &json_str) = 0#
Deserialize the parameter group from schema-validatable json string.
See also
validate(const std::string &json_str, std::string *error_msg = nullptr)
- Parameters:
json_str – [in] the schema-validatable json string.
- Throws:
aidi::excepts::InvalidJson – if the json string is invalid.
aidi::excepts::JsonSchemaValidationError – if the json string is not serialized from this parameter type or validation the json with json schema failed.
- Returns:
ISchemable& the reference of the parameter.
-
bool validate(const aidi::Buffer &json_str, std::string *error_msg = nullptr) const#
Validate the parameter json string with json schema.
- Parameters:
json_str – [in] the json string.
error_msg – [out] the error message if the json string is invalid, otherwise empty.
- Throws:
aidi::excepts::InvalidJson – if the json string is invalid.
- Returns:
bool true if the json string is valid, otherwise false.
-
virtual std::string json_schema() const = 0#
SchemableParameter#
-
struct SchemableParameter : public virtual aidi::param::IParameter, public virtual aidi::param::ISchemable#
SchemableParameter feature interface for IParameter classes.
Subclassed by aidi::param::CustomParam, aidi::param::ExampleAugRotate, aidi::param::ExampleAugShift, aidi::param::ExampleAugments, aidi::param::InputImageParam
CustomParam#
-
class CustomParam : public aidi::param::SchemableParameter#
CustomParam Parameter class generated by jinja2 automatically.
可自定义的扩展参数组,使用一个字典存储用户给定的任意键值对. 键和值都必须是字符串类型,对于非字符串类型,用户可自行转换为字符串.
Public Functions
-
virtual std::string json_schema() const override#
Get the json schema of the class.
- Returns:
std::string the json schema string.
-
const std::map<std::string, std::string> &get_ext() const#
Get Extend Parameters.
Extended parameters are used to set parameters conveniently in the development stage or for features that are not stable enough. In the officially released version, extended parameters should be used as little as possible.
See also
- Returns:
const std::map<std::string, std::string> & Extend Parameters
-
CustomParam &set_ext(const std::map<std::string, std::string> &ext)#
Set Extend Parameters with std::map<std::string, std::string> value.
Extended parameters are used to set parameters conveniently in the development stage or for features that are not stable enough. In the officially released version, extended parameters should be used as little as possible.
See also
- Parameters:
ext – the value to set.
- Throws:
aidi::excepts::JsonSchemaValidationError – if validate the value with json schema failed.
- Returns:
CustomParam& the reference of this object.
-
const std::string &get_ext_at(const std::string &key) const#
Get value in Extend Parameters with key.
Warning
The key must be exist in Extend Parameters. otherwise, the behavior is undefined and will cause segmentation fault.
- Returns:
const std::map<std::string, std::string> & value in Extend Parameters at key.
-
CustomParam &set_ext_at(const std::string &key, const std::string &value)#
Set value in Extend Parameters with key.
- Parameters:
key – the key to set.
value – the value to set.
- Throws:
aidi::excepts::JsonSchemaValidationError – if validate the value with json schema failed.
- Returns:
CustomParam& the reference of this object.
-
bool ext_contains(const std::string &key) const#
Check if the key is exist in Extend Parameters.
- Returns:
bool true if the key is exist in Extend Parameters, otherwise false.
-
size_t get_ext_size() const#
Get the size of Extend Parameters.
- Returns:
size_t the size of Extend Parameters
-
virtual std::string json_schema() const override#
InputImageParam#
-
class InputImageParam : public aidi::param::SchemableParameter#
InputImageParam Parameter class generated by jinja2 automatically.
输入图像相关参数,用于控制工程的输入图像格式规范.
Public Functions
-
virtual std::string json_schema() const override#
Get the json schema of the class.
- Returns:
std::string the json schema string.
-
int get_visual_size() const#
Get 可视图象数.
一个aidi.Image允许包含的可视图象数量, 多数情况下, 使用默认值1即可。若需要将多张图像当作一张图像处理, 可以设置为大于1的值。
See also
- Returns:
int 可视图象数
-
InputImageParam &set_visual_size(int visual_size)#
Set 可视图象数 with int value.
一个aidi.Image允许包含的可视图象数量, 多数情况下, 使用默认值1即可。若需要将多张图像当作一张图像处理, 可以设置为大于1的值。
See also
- Parameters:
visual_size – the value to set.
- Throws:
aidi::excepts::JsonSchemaValidationError – if validate the value with json schema failed.
- Returns:
InputImageParam& the reference of this object.
-
virtual std::string json_schema() const override#
以下参数项仅为示例#
-
class ExampleAugRotate : public aidi::param::SchemableParameter#
ExampleAugRotate Parameter class generated by jinja2 automatically.
Public Functions
-
virtual std::string json_schema() const override#
Get the json schema of the class.
- Returns:
std::string the json schema string.
-
bool get_enable() const#
Get Enable.
Enable this augments
See also
- Returns:
bool Enable
-
ExampleAugRotate &set_enable(bool enable)#
Set Enable with bool value.
Enable this augments
See also
- Parameters:
enable – the value to set.
- Throws:
aidi::excepts::JsonSchemaValidationError – if validate the value with json schema failed.
- Returns:
ExampleAugRotate& the reference of this object.
-
float get_rotate_angle() const#
Get Rotate Angle.
Rotate angle
See also
- Returns:
float Rotate Angle
-
ExampleAugRotate &set_rotate_angle(float rotate_angle)#
Set Rotate Angle with float value.
Rotate angle
See also
- Parameters:
rotate_angle – the value to set.
- Throws:
aidi::excepts::JsonSchemaValidationError – if validate the value with json schema failed.
- Returns:
ExampleAugRotate& the reference of this object.
-
bool get_filp_horizontal() const#
Get Flip Horizontal.
Flip horizontal
See also
- Returns:
bool Flip Horizontal
-
ExampleAugRotate &set_filp_horizontal(bool filp_horizontal)#
Set Flip Horizontal with bool value.
Flip horizontal
See also
- Parameters:
filp_horizontal – the value to set.
- Throws:
aidi::excepts::JsonSchemaValidationError – if validate the value with json schema failed.
- Returns:
ExampleAugRotate& the reference of this object.
-
bool get_flip_vertical() const#
Get Flip Vertical.
Flip vertical
See also
- Returns:
bool Flip Vertical
-
ExampleAugRotate &set_flip_vertical(bool flip_vertical)#
Set Flip Vertical with bool value.
Flip vertical
See also
- Parameters:
flip_vertical – the value to set.
- Throws:
aidi::excepts::JsonSchemaValidationError – if validate the value with json schema failed.
- Returns:
ExampleAugRotate& the reference of this object.
-
virtual std::string json_schema() const override#
-
class ExampleAugShift : public aidi::param::SchemableParameter#
ExampleAugShift Parameter class generated by jinja2 automatically.
Public Functions
-
virtual std::string json_schema() const override#
Get the json schema of the class.
- Returns:
std::string the json schema string.
-
bool get_enable() const#
Get Enable.
Enable this augments
See also
- Returns:
bool Enable
-
ExampleAugShift &set_enable(bool enable)#
Set Enable with bool value.
Enable this augments
See also
- Parameters:
enable – the value to set.
- Throws:
aidi::excepts::JsonSchemaValidationError – if validate the value with json schema failed.
- Returns:
ExampleAugShift& the reference of this object.
-
float get_shift_width() const#
Get Shift Width.
Shift width
See also
- Returns:
float Shift Width
-
ExampleAugShift &set_shift_width(float shift_width)#
Set Shift Width with float value.
Shift width
See also
- Parameters:
shift_width – the value to set.
- Throws:
aidi::excepts::JsonSchemaValidationError – if validate the value with json schema failed.
- Returns:
ExampleAugShift& the reference of this object.
-
float get_shift_height() const#
Get Shift Height.
Shift height
See also
- Returns:
float Shift Height
-
ExampleAugShift &set_shift_height(float shift_height)#
Set Shift Height with float value.
Shift height
See also
- Parameters:
shift_height – the value to set.
- Throws:
aidi::excepts::JsonSchemaValidationError – if validate the value with json schema failed.
- Returns:
ExampleAugShift& the reference of this object.
-
virtual std::string json_schema() const override#
-
class ExampleAugments : public aidi::param::SchemableParameter#
ExampleAugments Parameter class generated by jinja2 automatically.
Public Functions
-
virtual std::string json_schema() const override#
Get the json schema of the class.
- Returns:
std::string the json schema string.
-
bool get_enable() const#
Get Enable.
Enable this augments
See also
- Returns:
bool Enable
-
ExampleAugments &set_enable(bool enable)#
Set Enable with bool value.
Enable this augments
See also
- Parameters:
enable – the value to set.
- Throws:
aidi::excepts::JsonSchemaValidationError – if validate the value with json schema failed.
- Returns:
ExampleAugments& the reference of this object.
-
const ExampleAugShift &get_shift() const#
Get Shift.
Shift augments
See also
- Returns:
const ExampleAugShift & Shift
-
ExampleAugments &set_shift(const ExampleAugShift &shift)#
Set Shift with ExampleAugShift value.
Shift augments
See also
- Parameters:
shift – the value to set.
- Throws:
aidi::excepts::JsonSchemaValidationError – if validate the value with json schema failed.
- Returns:
ExampleAugments& the reference of this object.
-
ExampleAugShift &get_shift()#
Get mutable reference of Shift.
Shift augments
- Returns:
ExampleAugments& the mutable reference of the group.
-
const ExampleAugRotate &get_rotate() const#
Get Rotate.
Rotate augments
See also
- Returns:
const ExampleAugRotate & Rotate
-
ExampleAugments &set_rotate(const ExampleAugRotate &rotate)#
Set Rotate with ExampleAugRotate value.
Rotate augments
See also
- Parameters:
rotate – the value to set.
- Throws:
aidi::excepts::JsonSchemaValidationError – if validate the value with json schema failed.
- Returns:
ExampleAugments& the reference of this object.
-
ExampleAugRotate &get_rotate()#
Get mutable reference of Rotate.
Rotate augments
- Returns:
ExampleAugments& the mutable reference of the group.
-
virtual std::string json_schema() const override#