Parameter Types#
-
class IParameter#
Subclassed by aidi::param::SchemableParameter
-
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#
-
struct SchemableParameter : public virtual aidi::param::IParameter, public virtual aidi::param::ISchemable#
SchemableParameter feature interface for IParameter classes.
Subclassed by aidi::param::ExampleAugRotate, aidi::param::ExampleAugShift, aidi::param::ExampleAugments
以下参数项仅为示例#
-
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#