Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SmartDashboard.setDefault* documentation #6490

Merged
merged 3 commits into from
Dec 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions ntcore/src/main/native/include/networktables/GenericEntry.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
Expand All @@ -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);
Expand All @@ -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);
Expand All @@ -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);
Expand All @@ -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);
Expand All @@ -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);
Expand All @@ -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);
Expand All @@ -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);
Expand All @@ -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);
Expand All @@ -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);
Expand Down
32 changes: 16 additions & 16 deletions ntcore/src/main/native/include/networktables/NetworkTable.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -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);

Expand All @@ -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);

Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);

Expand Down
24 changes: 12 additions & 12 deletions ntcore/src/main/native/include/networktables/NetworkTableEntry.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
Expand All @@ -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);
Expand All @@ -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);
Expand All @@ -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);
Expand All @@ -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);
Expand All @@ -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);
Expand All @@ -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);
Expand All @@ -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);
Expand All @@ -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);
Expand All @@ -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);
Expand All @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions ntcore/src/main/native/include/ntcore_c.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions ntcore/src/main/native/include/ntcore_cpp.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading
Loading