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:
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.

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

set_enable()

Returns:

bool Enable

ExampleAugRotate &set_enable(bool enable)#

Set Enable with bool value.

Enable this augments

See also

get_enable()

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

Returns:

float Rotate Angle

ExampleAugRotate &set_rotate_angle(float rotate_angle)#

Set Rotate Angle with float value.

Rotate angle

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

Returns:

bool Flip Horizontal

ExampleAugRotate &set_filp_horizontal(bool filp_horizontal)#

Set Flip Horizontal with bool value.

Flip horizontal

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

Returns:

bool Flip Vertical

ExampleAugRotate &set_flip_vertical(bool flip_vertical)#

Set Flip Vertical with bool value.

Flip vertical

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.

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

set_enable()

Returns:

bool Enable

ExampleAugShift &set_enable(bool enable)#

Set Enable with bool value.

Enable this augments

See also

get_enable()

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

Returns:

float Shift Width

ExampleAugShift &set_shift_width(float shift_width)#

Set Shift Width with float value.

Shift width

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

Returns:

float Shift Height

ExampleAugShift &set_shift_height(float shift_height)#

Set Shift Height with float value.

Shift height

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.

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

set_enable()

Returns:

bool Enable

ExampleAugments &set_enable(bool enable)#

Set Enable with bool value.

Enable this augments

See also

get_enable()

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

set_shift()

Returns:

const ExampleAugShift & Shift

ExampleAugments &set_shift(const ExampleAugShift &shift)#

Set Shift with ExampleAugShift value.

Shift augments

See also

get_shift()

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

set_rotate()

Returns:

const ExampleAugRotate & Rotate

ExampleAugments &set_rotate(const ExampleAugRotate &rotate)#

Set Rotate with ExampleAugRotate value.

Rotate augments

See also

get_rotate()

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.