Add SD methods with default values to match Java (fixes artf3648)

Change-Id: Iee955f987ac1214d773cfd733ed99e3cbd1ac3d0
This commit is contained in:
Kevin O'Connor
2014-10-15 17:03:04 -04:00
parent 08c8723174
commit fea52a77a3
2 changed files with 36 additions and 3 deletions

View File

@@ -110,7 +110,7 @@ void SmartDashboard::PutBoolean(std::string keyName, bool value)
}
/**
* Returns the value at the specified key.
* Returns the value at the specified key. Throws an exception if the key is not found in the table
* @param keyName the key
* @return the value
*/
@@ -119,6 +119,16 @@ bool SmartDashboard::GetBoolean(std::string keyName)
return m_table->GetBoolean(keyName);
}
/**
* Returns the value at the specified key. If the key is not found, returns the default value.
* @param keyName the key
* @return the value
*/
bool SmartDashboard::GetBoolean(std::string keyName, bool defaultValue)
{
return m_table->GetBoolean(keyName, defaultValue);
}
/**
* Maps the specified key to the specified value in this table.
* The key can not be NULL.
@@ -131,7 +141,7 @@ void SmartDashboard::PutNumber(std::string keyName, double value){
}
/**
* Returns the value at the specified key.
* Returns the value at the specified key. Throws an exception if the key is not found in the table.
* @param keyName the key
* @return the value
*/
@@ -140,6 +150,16 @@ double SmartDashboard::GetNumber(std::string keyName)
return m_table->GetNumber(keyName);
}
/**
* Returns the value at the specified key. If the key is not found, returns the default value.
* @param keyName the key
* @return the value
*/
double SmartDashboard::GetNumber(std::string keyName, double defaultValue)
{
return m_table->GetNumber(keyName, defaultValue);
}
/**
* Maps the specified key to the specified value in this table.
* Neither the key nor the value can be NULL.
@@ -170,7 +190,7 @@ int SmartDashboard::GetString(std::string keyName, char *outBuffer, unsigned int
/**
* Returns the value at the specified key.
* Returns the value at the specified key. Throws an exception if the key is not found in the table
* @param keyName the key
* @return the value
*/
@@ -178,3 +198,13 @@ std::string SmartDashboard::GetString(std::string keyName)
{
return m_table->GetString(keyName);
}
/**
* Returns the value at the specified key. If the key is not found, returns the default value.
* @param keyName the key
* @return the value
*/
std::string SmartDashboard::GetString(std::string keyName, std::string defaultValue)
{
return m_table->GetString(keyName, defaultValue);
}