Browse Source

Add doc comments saying the Module::config*() can only be called from the Module subclass constructor.

tags/v2.0.0
Andrew Belt 2 years ago
parent
commit
0c4195e63b
1 changed files with 12 additions and 1 deletions
  1. +12
    -1
      include/engine/Module.hpp

+ 12
- 1
include/engine/Module.hpp View File

@@ -106,11 +106,14 @@ struct Module {
} }
virtual ~Module(); virtual ~Module();


/** Configures the number of Params, Outputs, Inputs, and Lights. */
/** Configures the number of Params, Outputs, Inputs, and Lights.
Should only be called from a Module subclass's constructor.
*/
void config(int numParams, int numInputs, int numOutputs, int numLights = 0); void config(int numParams, int numInputs, int numOutputs, int numLights = 0);


/** Helper for creating a ParamQuantity and setting its properties. /** Helper for creating a ParamQuantity and setting its properties.
See ParamQuantity for documentation of arguments. See ParamQuantity for documentation of arguments.
Should only be called from a Module subclass's constructor.
*/ */
template <class TParamQuantity = ParamQuantity> template <class TParamQuantity = ParamQuantity>
TParamQuantity* configParam(int paramId, float minValue, float maxValue, float defaultValue, std::string name = "", std::string unit = "", float displayBase = 0.f, float displayMultiplier = 1.f, float displayOffset = 0.f) { TParamQuantity* configParam(int paramId, float minValue, float maxValue, float defaultValue, std::string name = "", std::string unit = "", float displayBase = 0.f, float displayMultiplier = 1.f, float displayOffset = 0.f) {
@@ -138,6 +141,7 @@ struct Module {


/** Helper for creating a SwitchQuantity and setting its label strings. /** Helper for creating a SwitchQuantity and setting its label strings.
See ParamQuantity and SwitchQuantity for documentation of arguments. See ParamQuantity and SwitchQuantity for documentation of arguments.
Should only be called from a Module subclass's constructor.
*/ */
template <class TSwitchQuantity = SwitchQuantity> template <class TSwitchQuantity = SwitchQuantity>
TSwitchQuantity* configSwitch(int paramId, float minValue, float maxValue, float defaultValue, std::string name = "", std::vector<std::string> labels = {}) { TSwitchQuantity* configSwitch(int paramId, float minValue, float maxValue, float defaultValue, std::string name = "", std::vector<std::string> labels = {}) {
@@ -146,6 +150,9 @@ struct Module {
return sq; return sq;
} }


/** Helper for creating a SwitchQuantity with no label.
Should only be called from a Module subclass's constructor.
*/
template <class TSwitchQuantity = SwitchQuantity> template <class TSwitchQuantity = SwitchQuantity>
TSwitchQuantity* configButton(int paramId, std::string name = "") { TSwitchQuantity* configButton(int paramId, std::string name = "") {
TSwitchQuantity* sq = configParam<TSwitchQuantity>(paramId, 0.f, 1.f, 0.f, name); TSwitchQuantity* sq = configParam<TSwitchQuantity>(paramId, 0.f, 1.f, 0.f, name);
@@ -155,6 +162,7 @@ struct Module {


/** Helper for creating a PortInfo for an input port and setting its properties. /** Helper for creating a PortInfo for an input port and setting its properties.
See PortInfo for documentation of arguments. See PortInfo for documentation of arguments.
Should only be called from a Module subclass's constructor.
*/ */
template <class TPortInfo = PortInfo> template <class TPortInfo = PortInfo>
TPortInfo* configInput(int portId, std::string name = "") { TPortInfo* configInput(int portId, std::string name = "") {
@@ -173,6 +181,7 @@ struct Module {


/** Helper for creating a PortInfo for an output port and setting its properties. /** Helper for creating a PortInfo for an output port and setting its properties.
See PortInfo for documentation of arguments. See PortInfo for documentation of arguments.
Should only be called from a Module subclass's constructor.
*/ */
template <class TPortInfo = PortInfo> template <class TPortInfo = PortInfo>
TPortInfo* configOutput(int portId, std::string name = "") { TPortInfo* configOutput(int portId, std::string name = "") {
@@ -192,6 +201,7 @@ struct Module {
/** Helper for creating a LightInfo and setting its properties. /** Helper for creating a LightInfo and setting its properties.
For multi-colored lights, use the first lightId. For multi-colored lights, use the first lightId.
See LightInfo for documentation of arguments. See LightInfo for documentation of arguments.
Should only be called from a Module subclass's constructor.
*/ */
template <class TLightInfo = LightInfo> template <class TLightInfo = LightInfo>
TLightInfo* configLight(int lightId, std::string name = "") { TLightInfo* configLight(int lightId, std::string name = "") {
@@ -208,6 +218,7 @@ struct Module {
} }


/** Adds a direct route from an input to an output when the module is bypassed. /** Adds a direct route from an input to an output when the module is bypassed.
Should only be called from a Module subclass's constructor.
*/ */
void configBypass(int inputId, int outputId) { void configBypass(int inputId, int outputId) {
assert(inputId < (int) inputs.size()); assert(inputId < (int) inputs.size());


Loading…
Cancel
Save