Search Results for

    Show / Hide Table of Contents

    Class model::Terms

    Inheritance
    utils::Component
    model::Terms
    Inherited Members
    render
    ~Component
    Component
    get_status
    param
    get_class_name

    Methods

    configure()

    configure the object from input

    Initialize the object's state from the input utils::Config. This is done by declaring which required and optional parameters are associated with the fields of this object. During initialization, they are checked for their presence, type and any matchers. Example:

    MyClass : public Component {
     public:
      void configure(const utils::Json& json) override {
        this->param(json, "number", my_number)
            .description("some description")
            .matches(GreaterEquals(0))
            .required();
        this->param(json, "name", my_name)
            .description("some description")
            .matches(SizeIs(GreaterThan(0)))
            .default_value("no_name");
      }
    
     private:
      int my_number;
      std::string my_name;
    }
    
    MyClass my_object;
    my_object.configure(utils::json_from_string(R"(
      {
        "number": 42,
        "name": "hello"
      }
    )"));
    
    Note

    By default, nothing is configured from input. You need to overload this method if you want to use this functionality. Don't forget to call the configure method of the parent class if it also needs to be configured (this is not the case for utils::Component itself). HINT: Parameters are not limited to scalars and strings; Any component can be a parameter; in which case it is initialized using its own configure method. utils::Json

    Declaration
    void model::Terms::configure(const utils::Json&json) override

    configure()

    Declaration
    void model::Terms::configure(Configuration_T&config)

    init()

    Declaration
    void model::Terms::init()
    In This Article
    Back to top Generated with Doxygen and DocFX