[wpilib] Fix SmartDashboard.setDefault* docs (NFC) (#6490)

Fix incorrect comments related to NT SetDefault* methods across multiple components
This commit is contained in:
Carl Hauser
2024-12-29 16:41:29 -08:00
committed by GitHub
parent 78b6d61e88
commit eef1bf33de
7 changed files with 97 additions and 97 deletions

View File

@@ -387,7 +387,7 @@ class GenericPublisher : public Publisher {
* Sets the entry's value if it does not exist.
*
* @param defaultValue the default value to set
* @return False if the entry exists with a different type
* @return True if the entry did not already have a value, otherwise False
*/
bool SetDefaultBoolean(bool defaultValue) {
return nt::SetDefaultBoolean(m_pubHandle, defaultValue);
@@ -397,7 +397,7 @@ class GenericPublisher : public Publisher {
* Sets the entry's value if it does not exist.
*
* @param defaultValue the default value to set
* @return False if the entry exists with a different type
* @return True if the entry did not already have a value, otherwise False
*/
bool SetDefaultInteger(int64_t defaultValue) {
return nt::SetDefaultInteger(m_pubHandle, defaultValue);
@@ -407,7 +407,7 @@ class GenericPublisher : public Publisher {
* Sets the entry's value if it does not exist.
*
* @param defaultValue the default value to set
* @return False if the entry exists with a different type
* @return True if the entry did not already have a value, otherwise False
*/
bool SetDefaultFloat(float defaultValue) {
return nt::SetDefaultFloat(m_pubHandle, defaultValue);
@@ -417,7 +417,7 @@ class GenericPublisher : public Publisher {
* Sets the entry's value if it does not exist.
*
* @param defaultValue the default value to set
* @return False if the entry exists with a different type
* @return True if the entry did not already have a value, otherwise False
*/
bool SetDefaultDouble(double defaultValue) {
return nt::SetDefaultDouble(m_pubHandle, defaultValue);
@@ -427,7 +427,7 @@ class GenericPublisher : public Publisher {
* Sets the entry's value if it does not exist.
*
* @param defaultValue the default value to set
* @return False if the entry exists with a different type
* @return True if the entry did not already have a value, otherwise False
*/
bool SetDefaultString(std::string_view defaultValue) {
return nt::SetDefaultString(m_pubHandle, defaultValue);
@@ -437,7 +437,7 @@ class GenericPublisher : public Publisher {
* Sets the entry's value if it does not exist.
*
* @param defaultValue the default value to set
* @return False if the entry exists with a different type
* @return True if the entry did not already have a value, otherwise False
*/
bool SetDefaultRaw(std::span<const uint8_t> defaultValue) {
return nt::SetDefaultRaw(m_pubHandle, defaultValue);
@@ -447,7 +447,7 @@ class GenericPublisher : public Publisher {
* Sets the entry's value if it does not exist.
*
* @param defaultValue the default value to set
* @return False if the entry exists with a different type
* @return True if the entry did not already have a value, otherwise False
*/
bool SetDefaultBooleanArray(std::span<const int> defaultValue) {
return nt::SetDefaultBooleanArray(m_pubHandle, defaultValue);
@@ -457,7 +457,7 @@ class GenericPublisher : public Publisher {
* Sets the entry's value if it does not exist.
*
* @param defaultValue the default value to set
* @return False if the entry exists with a different type
* @return True if the entry did not already have a value, otherwise False
*/
bool SetDefaultIntegerArray(std::span<const int64_t> defaultValue) {
return nt::SetDefaultIntegerArray(m_pubHandle, defaultValue);
@@ -467,7 +467,7 @@ class GenericPublisher : public Publisher {
* Sets the entry's value if it does not exist.
*
* @param defaultValue the default value to set
* @return False if the entry exists with a different type
* @return True if the entry did not already have a value, otherwise False
*/
bool SetDefaultFloatArray(std::span<const float> defaultValue) {
return nt::SetDefaultFloatArray(m_pubHandle, defaultValue);
@@ -477,7 +477,7 @@ class GenericPublisher : public Publisher {
* Sets the entry's value if it does not exist.
*
* @param defaultValue the default value to set
* @return False if the entry exists with a different type
* @return True if the entry did not already have a value, otherwise False
*/
bool SetDefaultDoubleArray(std::span<const double> defaultValue) {
return nt::SetDefaultDoubleArray(m_pubHandle, defaultValue);
@@ -487,7 +487,7 @@ class GenericPublisher : public Publisher {
* Sets the entry's value if it does not exist.
*
* @param defaultValue the default value to set
* @return False if the entry exists with a different type
* @return True if the entry did not already have a value, otherwise False
*/
bool SetDefaultStringArray(std::span<const std::string> defaultValue) {
return nt::SetDefaultStringArray(m_pubHandle, defaultValue);

View File

@@ -361,11 +361,11 @@ class NetworkTable final {
bool PutNumber(std::string_view key, double value);
/**
* Gets the current value in the table, setting it if it does not exist.
* Set Default Entry Value
*
* @param key the key
* @param defaultValue the default value to set if key doesn't exist.
* @returns False if the table key exists with a different type
* @returns True if the table key did not already exist, otherwise False
*/
bool SetDefaultNumber(std::string_view key, double defaultValue);
@@ -389,11 +389,11 @@ class NetworkTable final {
bool PutString(std::string_view key, std::string_view value);
/**
* Gets the current value in the table, setting it if it does not exist.
* Set Default Entry Value
*
* @param key the key
* @param defaultValue the default value to set if key doesn't exist.
* @returns False if the table key exists with a different type
* @returns True if the table key did not already exist, otherwise False
*/
bool SetDefaultString(std::string_view key, std::string_view defaultValue);
@@ -419,11 +419,11 @@ class NetworkTable final {
bool PutBoolean(std::string_view key, bool value);
/**
* Gets the current value in the table, setting it if it does not exist.
* Set Default Entry Value
*
* @param key the key
* @param defaultValue the default value to set if key doesn't exist.
* @returns False if the table key exists with a different type
* @returns True if the table key did not already exist, otherwise False
*/
bool SetDefaultBoolean(std::string_view key, bool defaultValue);
@@ -452,11 +452,11 @@ class NetworkTable final {
bool PutBooleanArray(std::string_view key, std::span<const int> value);
/**
* Gets the current value in the table, setting it if it does not exist.
* Set Default Entry Value
*
* @param key the key
* @param defaultValue the default value to set if key doesn't exist.
* @return False if the table key exists with a different type
* @return True if the table key did not already exist, otherwise False
*/
bool SetDefaultBooleanArray(std::string_view key,
std::span<const int> defaultValue);
@@ -490,11 +490,11 @@ class NetworkTable final {
bool PutNumberArray(std::string_view key, std::span<const double> value);
/**
* Gets the current value in the table, setting it if it does not exist.
* Set Default Entry Value
*
* @param key the key
* @param defaultValue the default value to set if key doesn't exist.
* @returns False if the table key exists with a different type
* @returns True if the table key did not already exist, otherwise False
*/
bool SetDefaultNumberArray(std::string_view key,
std::span<const double> defaultValue);
@@ -524,11 +524,11 @@ class NetworkTable final {
bool PutStringArray(std::string_view key, std::span<const std::string> value);
/**
* Gets the current value in the table, setting it if it does not exist.
* Set Default Entry Value
*
* @param key the key
* @param defaultValue the default value to set if key doesn't exist.
* @returns False if the table key exists with a different type
* @returns True if the table key did not already exist, otherwise False
*/
bool SetDefaultStringArray(std::string_view key,
std::span<const std::string> defaultValue);
@@ -558,11 +558,11 @@ class NetworkTable final {
bool PutRaw(std::string_view key, std::span<const uint8_t> value);
/**
* Gets the current value in the table, setting it if it does not exist.
* Set Default Entry Value
*
* @param key the key
* @param defaultValue the default value to set if key doesn't exist.
* @return False if the table key exists with a different type
* @return True if the table key did not already exist, otherwise False
*/
bool SetDefaultRaw(std::string_view key,
std::span<const uint8_t> defaultValue);
@@ -592,11 +592,11 @@ class NetworkTable final {
bool PutValue(std::string_view key, const Value& value);
/**
* Gets the current value in the table, setting it if it does not exist.
* Set Default Entry Value.
*
* @param key the key
* @param defaultValue the default value to set if key doesn't exist.
* @return False if the table key exists with a different type
* @return True if the table key did not already exist, otherwise False
*/
bool SetDefaultValue(std::string_view key, const Value& defaultValue);

View File

@@ -260,7 +260,7 @@ class NetworkTableEntry final {
* Sets the entry's value if it does not exist.
*
* @param defaultValue the default value to set
* @return False if the entry exists with a different type
* @return True if the entry did not already have a value, otherwise False
*/
bool SetDefaultValue(const Value& defaultValue) {
return SetDefaultEntryValue(m_handle, defaultValue);
@@ -270,7 +270,7 @@ class NetworkTableEntry final {
* Sets the entry's value if it does not exist.
*
* @param defaultValue the default value to set
* @return False if the entry exists with a different type
* @return True if the entry did not already have a value, otherwise False
*/
bool SetDefaultBoolean(bool defaultValue) {
return nt::SetDefaultBoolean(m_handle, defaultValue);
@@ -280,7 +280,7 @@ class NetworkTableEntry final {
* Sets the entry's value if it does not exist.
*
* @param defaultValue the default value to set
* @return False if the entry exists with a different type
* @return True if the entry did not already have a value, otherwise False
*/
bool SetDefaultInteger(int64_t defaultValue) {
return nt::SetDefaultInteger(m_handle, defaultValue);
@@ -290,7 +290,7 @@ class NetworkTableEntry final {
* Sets the entry's value if it does not exist.
*
* @param defaultValue the default value to set
* @return False if the entry exists with a different type
* @return True if the entry did not already have a value, otherwise False
*/
bool SetDefaultFloat(float defaultValue) {
return nt::SetDefaultFloat(m_handle, defaultValue);
@@ -300,7 +300,7 @@ class NetworkTableEntry final {
* Sets the entry's value if it does not exist.
*
* @param defaultValue the default value to set
* @return False if the entry exists with a different type
* @return True if the entry did not already have a value, otherwise False
*/
bool SetDefaultDouble(double defaultValue) {
return nt::SetDefaultDouble(m_handle, defaultValue);
@@ -310,7 +310,7 @@ class NetworkTableEntry final {
* Sets the entry's value if it does not exist.
*
* @param defaultValue the default value to set
* @return False if the entry exists with a different type
* @return True if the entry did not already have a value, otherwise False
*/
bool SetDefaultString(std::string_view defaultValue) {
return nt::SetDefaultString(m_handle, defaultValue);
@@ -320,7 +320,7 @@ class NetworkTableEntry final {
* Sets the entry's value if it does not exist.
*
* @param defaultValue the default value to set
* @return False if the entry exists with a different type
* @return True if the entry did not already have a value, otherwise False
*/
bool SetDefaultRaw(std::span<const uint8_t> defaultValue) {
return nt::SetDefaultRaw(m_handle, defaultValue);
@@ -330,7 +330,7 @@ class NetworkTableEntry final {
* Sets the entry's value if it does not exist.
*
* @param defaultValue the default value to set
* @return False if the entry exists with a different type
* @return True if the entry did not already have a value, otherwise False
*/
bool SetDefaultBooleanArray(std::span<const int> defaultValue) {
return nt::SetDefaultBooleanArray(m_handle, defaultValue);
@@ -340,7 +340,7 @@ class NetworkTableEntry final {
* Sets the entry's value if it does not exist.
*
* @param defaultValue the default value to set
* @return False if the entry exists with a different type
* @return True if the entry did not already have a value, otherwise False
*/
bool SetDefaultIntegerArray(std::span<const int64_t> defaultValue) {
return nt::SetDefaultIntegerArray(m_handle, defaultValue);
@@ -350,7 +350,7 @@ class NetworkTableEntry final {
* Sets the entry's value if it does not exist.
*
* @param defaultValue the default value to set
* @return False if the entry exists with a different type
* @return True if the entry did not already have a value, otherwise False
*/
bool SetDefaultFloatArray(std::span<const float> defaultValue) {
return nt::SetDefaultFloatArray(m_handle, defaultValue);
@@ -360,7 +360,7 @@ class NetworkTableEntry final {
* Sets the entry's value if it does not exist.
*
* @param defaultValue the default value to set
* @return False if the entry exists with a different type
* @return True if the entry did not already have a value, otherwise False
*/
bool SetDefaultDoubleArray(std::span<const double> defaultValue) {
return nt::SetDefaultDoubleArray(m_handle, defaultValue);
@@ -370,7 +370,7 @@ class NetworkTableEntry final {
* Sets the entry's value if it does not exist.
*
* @param defaultValue the default value to set
* @return False if the entry exists with a different type
* @return True if the entry did not already have a value, otherwise False
*/
bool SetDefaultStringArray(std::span<const std::string> defaultValue) {
return nt::SetDefaultStringArray(m_handle, defaultValue);

View File

@@ -476,8 +476,8 @@ void NT_GetEntryValueType(NT_Entry entry, unsigned int types,
/**
* Set Default Entry Value.
*
* Returns copy of current entry value if it exists.
* Otherwise, sets passed in value, and returns set value.
* Returns 0 if name exists.
* Otherwise, sets passed in value, and returns 1.
* Note that one of the type options is "unassigned".
*
* @param entry entry handle

View File

@@ -488,8 +488,8 @@ Value GetEntryValue(NT_Handle subentry);
/**
* Set Default Entry Value
*
* Returns copy of current entry value if it exists.
* Otherwise, sets passed in value, and returns set value.
* Returns False if name exists.
* Otherwise, sets passed in value, and returns True.
* Note that one of the type options is "unassigned".
*
* @param entry entry handle

View File

@@ -122,10 +122,10 @@ class SmartDashboard {
static bool PutBoolean(std::string_view keyName, bool value);
/**
* Gets the current value in the table, setting it if it does not exist.
* Set the value in the table if key does not exist
* @param key the key
* @param defaultValue the default value to set if key doesn't exist.
* @returns False if the table key exists with a different type
* @param defaultValue the value to set if key doesn't exist.
* @returns True if the table key did not already exist, otherwise False
*/
static bool SetDefaultBoolean(std::string_view key, bool defaultValue);
@@ -135,7 +135,7 @@ class SmartDashboard {
* If the key is not found, returns the default value.
*
* @param keyName the key
* @param defaultValue the default value to set if key doesn't exist
* @param defaultValue the default value to return if key doesn't exist
* @return the value
*/
static bool GetBoolean(std::string_view keyName, bool defaultValue);
@@ -153,11 +153,11 @@ class SmartDashboard {
static bool PutNumber(std::string_view keyName, double value);
/**
* Gets the current value in the table, setting it if it does not exist.
* Set the value in the table if key does not exist.
*
* @param key The key.
* @param defaultValue The default value to set if key doesn't exist.
* @returns False if the table key exists with a different type
* @param defaultValue The value to set if key doesn't exist.
* @returns True if the table key did not already exist, otherwise False
*/
static bool SetDefaultNumber(std::string_view key, double defaultValue);
@@ -167,7 +167,7 @@ class SmartDashboard {
* If the key is not found, returns the default value.
*
* @param keyName the key
* @param defaultValue the default value to set if the key doesn't exist
* @param defaultValue the default value to return if the key doesn't exist
* @return the value
*/
static double GetNumber(std::string_view keyName, double defaultValue);
@@ -185,11 +185,11 @@ class SmartDashboard {
static bool PutString(std::string_view keyName, std::string_view value);
/**
* Gets the current value in the table, setting it if it does not exist.
* Set the value in the table if key does not exist.
*
* @param key the key
* @param defaultValue the default value to set if key doesn't exist.
* @returns False if the table key exists with a different type
* @param defaultValue the value to set if key doesn't exist.
* @returns True if the table key did not already exist, otherwise False
*/
static bool SetDefaultString(std::string_view key,
std::string_view defaultValue);
@@ -200,7 +200,7 @@ class SmartDashboard {
* If the key is not found, returns the default value.
*
* @param keyName the key
* @param defaultValue the default value to set if the key doesn't exist
* @param defaultValue the default value to return if the key doesn't exist
* @return the value
*/
static std::string GetString(std::string_view keyName,
@@ -220,11 +220,11 @@ class SmartDashboard {
static bool PutBooleanArray(std::string_view key, std::span<const int> value);
/**
* Gets the current value in the table, setting it if it does not exist.
* Set the value in the table if key does not exist.
*
* @param key the key
* @param defaultValue the default value to set if key doesn't exist.
* @returns False if the table key exists with a different type
* @param defaultValue the value to set if key doesn't exist.
* @returns True if the table key did not already exist, otherwise False
*/
static bool SetDefaultBooleanArray(std::string_view key,
std::span<const int> defaultValue);
@@ -261,11 +261,11 @@ class SmartDashboard {
std::span<const double> value);
/**
* Gets the current value in the table, setting it if it does not exist.
* Set the value in the table if key does not exist.
*
* @param key The key.
* @param defaultValue The default value to set if key doesn't exist.
* @returns False if the table key exists with a different type
* @param defaultValue The value to set if key doesn't exist.
* @returns True if the table key did not already exist, otherwise False
*/
static bool SetDefaultNumberArray(std::string_view key,
std::span<const double> defaultValue);
@@ -298,11 +298,11 @@ class SmartDashboard {
std::span<const std::string> value);
/**
* Gets the current value in the table, setting it if it does not exist.
* Set the value in the table if key does not exist.
*
* @param key The key.
* @param defaultValue The default value to set if key doesn't exist.
* @returns False if the table key exists with a different type
* @param defaultValue The value to set if key doesn't exist.
* @returns True if the table key did not already exist, otherwise False
*/
static bool SetDefaultStringArray(std::string_view key,
std::span<const std::string> defaultValue);
@@ -334,11 +334,11 @@ class SmartDashboard {
static bool PutRaw(std::string_view key, std::span<const uint8_t> value);
/**
* Gets the current value in the table, setting it if it does not exist.
* Set the value in the table if key does not exist.
*
* @param key The key.
* @param defaultValue The default value to set if key doesn't exist.
* @returns False if the table key exists with a different type
* @param defaultValue The value to set if key doesn't exist.
* @returns True if the table key did not already exist, otherwise False
*/
static bool SetDefaultRaw(std::string_view key,
std::span<const uint8_t> defaultValue);
@@ -374,11 +374,11 @@ class SmartDashboard {
static bool PutValue(std::string_view keyName, const nt::Value& value);
/**
* Gets the current value in the table, setting it if it does not exist.
* Set the value in the table if key does not exist.
*
* @param key the key
* @param defaultValue The default value to set if key doesn't exist.
* @returns False if the table key exists with a different type
* @param defaultValue The value to set if key doesn't exist.
* @returns True if the table key did not already exist, otherwise False
*/
static bool SetDefaultValue(std::string_view key,
const nt::Value& defaultValue);

View File

@@ -196,11 +196,11 @@ public final class SmartDashboard {
}
/**
* Gets the current value in the table, setting it if it does not exist.
* Set the value in the table if key does not exist.
*
* @param key the key
* @param defaultValue the default value to set if key does not exist.
* @return False if the table key exists with a different type
* @param defaultValue the value to set if key does not exist
* @return True if the key did not already exist, otherwise False
*/
public static boolean setDefaultBoolean(String key, boolean defaultValue) {
return getEntry(key).setDefaultBoolean(defaultValue);
@@ -231,11 +231,11 @@ public final class SmartDashboard {
}
/**
* Gets the current value in the table, setting it if it does not exist.
* Set the value in the table if key does not exist.
*
* @param key the key
* @param defaultValue the default value to set if key does not exist.
* @return False if the table key exists with a different type
* @param defaultValue the value to set if key does not exist
* @return True if the key did not already exist, otherwise False
*/
public static boolean setDefaultNumber(String key, double defaultValue) {
return getEntry(key).setDefaultDouble(defaultValue);
@@ -266,11 +266,11 @@ public final class SmartDashboard {
}
/**
* Gets the current value in the table, setting it if it does not exist.
* Set the value in the table if key does not exist.
*
* @param key the key
* @param defaultValue the default value to set if key does not exist.
* @return False if the table key exists with a different type
* @param defaultValue the value to set if key does not exist
* @return True if the key did not already exist, otherwise False
*/
public static boolean setDefaultString(String key, String defaultValue) {
return getEntry(key).setDefaultString(defaultValue);
@@ -312,22 +312,22 @@ public final class SmartDashboard {
}
/**
* Gets the current value in the table, setting it if it does not exist.
* Set the value in the table if key does not exist.
*
* @param key the key
* @param defaultValue the default value to set if key does not exist.
* @return False if the table key exists with a different type
* @param defaultValue the value to set if key does not exist
* @return True if the key did not already exist, otherwise False
*/
public static boolean setDefaultBooleanArray(String key, boolean[] defaultValue) {
return getEntry(key).setDefaultBooleanArray(defaultValue);
}
/**
* Gets the current value in the table, setting it if it does not exist.
* Set the value in the table if key does not exist.
*
* @param key the key
* @param defaultValue the default value to set if key does not exist.
* @return False if the table key exists with a different type
* @param defaultValue the value to set if key does not exist
* @return True if the key did not already exist, otherwise False
*/
public static boolean setDefaultBooleanArray(String key, Boolean[] defaultValue) {
return getEntry(key).setDefaultBooleanArray(defaultValue);
@@ -382,22 +382,22 @@ public final class SmartDashboard {
}
/**
* Gets the current value in the table, setting it if it does not exist.
* Set the value in the table if key does not exist.
*
* @param key the key
* @param defaultValue the default value to set if key does not exist.
* @return False if the table key exists with a different type
* @param defaultValue the value to set if key does not exist
* @return True if the key did not already exist, otherwise False
*/
public static boolean setDefaultNumberArray(String key, double[] defaultValue) {
return getEntry(key).setDefaultDoubleArray(defaultValue);
}
/**
* Gets the current value in the table, setting it if it does not exist.
* Set the value in the table if key does not exist.
*
* @param key the key
* @param defaultValue the default value to set if key does not exist.
* @return False if the table key exists with a different type
* @param defaultValue the value to set if key does not exist
* @return True if the key did not already exist, otherwise False
*/
public static boolean setDefaultNumberArray(String key, Double[] defaultValue) {
return getEntry(key).setDefaultNumberArray(defaultValue);
@@ -441,11 +441,11 @@ public final class SmartDashboard {
}
/**
* Gets the current value in the table, setting it if it does not exist.
* Set the value in the table if key does not exist.
*
* @param key the key
* @param defaultValue the default value to set if key does not exist.
* @return False if the table key exists with a different type
* @param defaultValue the value to set if key does not exist
* @return True if the key did not already exist, otherwise False
*/
public static boolean setDefaultStringArray(String key, String[] defaultValue) {
return getEntry(key).setDefaultStringArray(defaultValue);
@@ -476,11 +476,11 @@ public final class SmartDashboard {
}
/**
* Gets the current value in the table, setting it if it does not exist.
* Set the value in the table if key does not exist.
*
* @param key the key
* @param defaultValue the default value to set if key does not exist.
* @return False if the table key exists with a different type
* @param defaultValue the value to set if key does not exist
* @return True if the key did not already exist, otherwise False
*/
public static boolean setDefaultRaw(String key, byte[] defaultValue) {
return getEntry(key).setDefaultRaw(defaultValue);