CTRE Phoenix C++ 5.33.1
CustomParamConfiguration.h
Go to the documentation of this file.
1/* Copyright (C) Cross The Road Electronics 2024 */
2#pragma once
3
4#include <string>
5
6namespace ctre {
7namespace phoenix {
8/**
9 * Configurables for any custom param configs
10 */
12 /**
13 * Custom Param 0
14 */
16 /**
17 * Custom Param 1
18 */
20 /**
21 * Enable optimizations for ConfigAll (defaults true)
22 */
25 customParam0(0),
26 customParam1(0),
28 {
29 }
30
31 /**
32 * @return string representation of currently selected configs
33 */
34 std::string toString() {
35 return toString("");
36 }
37
38 /**
39 * @param prependString String to prepend to all the configs
40 * @return string representation fo currently selected configs
41 */
42 std::string toString(std::string prependString) {
43 std::string retstr = prependString + ".customParam0 = " + std::to_string(customParam0) + ";\n";
44 retstr += prependString + ".customParam1 = " + std::to_string(customParam1) + ";\n";
45
46 return retstr;
47 }
48};
49
50/**
51 * Util class to help custom configs
52 */
54 private:
55 static CustomParamConfiguration _default;
56 public:
57 /**
58 * @param settings Settings to compare against
59 * @return Whether CustomParam0 is different
60 */
61 static bool CustomParam0Different (const CustomParamConfiguration & settings) { return (!(settings.customParam0 == _default.customParam0)) || !settings.enableOptimizations; }
62 /**
63 * @param settings Settings to compare against
64 * @return Whether CustomParam1 is different
65 */
66 static bool CustomParam1Different (const CustomParamConfiguration & settings) { return (!(settings.customParam1 == _default.customParam1)) || !settings.enableOptimizations; }
67};
68}
69}
namespace ctre
Definition: paramEnum.h:5
Util class to help custom configs.
Definition: CustomParamConfiguration.h:53
static bool CustomParam0Different(const CustomParamConfiguration &settings)
Definition: CustomParamConfiguration.h:61
static bool CustomParam1Different(const CustomParamConfiguration &settings)
Definition: CustomParamConfiguration.h:66
Configurables for any custom param configs.
Definition: CustomParamConfiguration.h:11
CustomParamConfiguration()
Definition: CustomParamConfiguration.h:24
int customParam1
Custom Param 1.
Definition: CustomParamConfiguration.h:19
bool enableOptimizations
Enable optimizations for ConfigAll (defaults true)
Definition: CustomParamConfiguration.h:23
int customParam0
Custom Param 0.
Definition: CustomParamConfiguration.h:15
std::string toString(std::string prependString)
Definition: CustomParamConfiguration.h:42
std::string toString()
Definition: CustomParamConfiguration.h:34