Switchboard Extension SDK
Loading...
Searching...
No Matches
Parameter.hpp
1//
2// Parameter.hpp
3// SwitchboardSDK
4//
5// Created by Balazs Kiss on 2023. 05. 25..
6//
7
8#pragma once
9
10#include <switchboard_core/SwitchboardCore.hpp>
11
12#include <any>
13#include <string>
14
15namespace switchboard {
16
20class Parameter {
21public:
22 enum class Type { Float, Bool, Int, UInt, String };
23
32 Parameter(const Type type, const std::string& id, const std::string& name, const std::string& description);
33
37 virtual ~Parameter() = default;
38
44 Type getType() const;
45
51 const std::string& getID() const;
52
58 const std::string& getName() const;
59
65 const std::string& getDescription() const;
66
72 virtual void setValue(std::any newValue) = 0;
73
79 virtual std::any getAnyValue() = 0;
80
86 virtual std::any getDefaultValue() const;
87
88private:
89 Type type;
90 std::string id;
91 std::string name;
92 std::string description;
93
94protected:
95 std::any defaultValue;
96};
97
98}
Parameter(const Type type, const std::string &id, const std::string &name, const std::string &description)
Construct a new Parameter object.
virtual std::any getAnyValue()=0
Gets the value of the parameter.
virtual void setValue(std::any newValue)=0
Sets the value of the parameter.
const std::string & getName() const
Gets the name of the parameter.
virtual std::any getDefaultValue() const
Gets the default value of the parameter.
Type getType() const
Gets the type of the parameter.
const std::string & getDescription() const
Gets the description of the parameter.
const std::string & getID() const
Gets the unique identifier of the parameter.
virtual ~Parameter()=default
Parameter destructor.