mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-22 01:11:42 +00:00
Add format script which invokes clang-format on the C++ source code (#41)
On Windows machines, clang-format.exe must be in the PATH environment variable.
This commit is contained in:
committed by
Peter Johnson
parent
68690643d2
commit
e14e45da76
@@ -8,13 +8,13 @@
|
||||
#include "SmartDashboard/SmartDashboard.h"
|
||||
|
||||
//#include "NetworkCommunication/UsageReporting.h"
|
||||
#include "HLUsageReporting.h"
|
||||
#include "SmartDashboard/NamedSendable.h"
|
||||
#include "WPIErrors.h"
|
||||
#include "networktables/NetworkTable.h"
|
||||
#include "HLUsageReporting.h"
|
||||
|
||||
std::shared_ptr<ITable> SmartDashboard::m_table;
|
||||
std::map<std::shared_ptr<ITable> , Sendable *> SmartDashboard::m_tablesToData;
|
||||
std::map<std::shared_ptr<ITable>, Sendable*> SmartDashboard::m_tablesToData;
|
||||
|
||||
void SmartDashboard::init() {
|
||||
m_table = NetworkTable::GetTable("SmartDashboard");
|
||||
@@ -24,13 +24,14 @@ void SmartDashboard::init() {
|
||||
|
||||
/**
|
||||
* Maps the specified key to the specified value in this table.
|
||||
* The key can not be nullptr.
|
||||
*
|
||||
* The value can be retrieved by calling the get method with a key that is equal
|
||||
* to the original key.
|
||||
*
|
||||
* @param keyName the key
|
||||
* @param value the value
|
||||
* @param value the value
|
||||
*/
|
||||
void SmartDashboard::PutData(llvm::StringRef key, Sendable *data) {
|
||||
void SmartDashboard::PutData(llvm::StringRef key, Sendable* data) {
|
||||
if (data == nullptr) {
|
||||
wpi_setGlobalWPIErrorWithContext(NullParameter, "value");
|
||||
return;
|
||||
@@ -42,14 +43,15 @@ void SmartDashboard::PutData(llvm::StringRef key, Sendable *data) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Maps the specified key (where the key is the name of the {@link
|
||||
* SmartDashboardNamedData}
|
||||
* to the specified value in this table.
|
||||
* Maps the specified key (where the key is the name of the
|
||||
* {@link SmartDashboardNamedData} to the specified value in this table.
|
||||
*
|
||||
* The value can be retrieved by calling the get method with a key that is equal
|
||||
* to the original key.
|
||||
*
|
||||
* @param value the value
|
||||
*/
|
||||
void SmartDashboard::PutData(NamedSendable *value) {
|
||||
void SmartDashboard::PutData(NamedSendable* value) {
|
||||
if (value == nullptr) {
|
||||
wpi_setGlobalWPIErrorWithContext(NullParameter, "value");
|
||||
return;
|
||||
@@ -59,12 +61,13 @@ void SmartDashboard::PutData(NamedSendable *value) {
|
||||
|
||||
/**
|
||||
* Returns the value at the specified key.
|
||||
*
|
||||
* @param keyName the key
|
||||
* @return the value
|
||||
*/
|
||||
Sendable *SmartDashboard::GetData(llvm::StringRef key) {
|
||||
Sendable* SmartDashboard::GetData(llvm::StringRef key) {
|
||||
std::shared_ptr<ITable> subtable(m_table->GetSubTable(key));
|
||||
Sendable *data = m_tablesToData[subtable];
|
||||
Sendable* data = m_tablesToData[subtable];
|
||||
if (data == nullptr) {
|
||||
wpi_setGlobalWPIErrorWithContext(SmartDashboardMissingKey, key);
|
||||
return nullptr;
|
||||
@@ -75,11 +78,12 @@ Sendable *SmartDashboard::GetData(llvm::StringRef key) {
|
||||
/**
|
||||
* Maps the specified key to the specified complex value (such as an array) in
|
||||
* this table.
|
||||
* The key can not be nullptr.
|
||||
*
|
||||
* The value can be retrieved by calling the RetrieveValue method with a key
|
||||
* that is equal to the original key.
|
||||
*
|
||||
* @param keyName the key
|
||||
* @param value the value
|
||||
* @param value the value
|
||||
*/
|
||||
void SmartDashboard::PutValue(llvm::StringRef keyName,
|
||||
std::shared_ptr<nt::Value> value) {
|
||||
@@ -88,10 +92,10 @@ void SmartDashboard::PutValue(llvm::StringRef keyName,
|
||||
|
||||
/**
|
||||
* Retrieves the complex value (such as an array) in this table into the complex
|
||||
* data object
|
||||
* The key can not be nullptr.
|
||||
* data object.
|
||||
*
|
||||
* @param keyName the key
|
||||
* @param value the object to retrieve the value into
|
||||
* @param value the object to retrieve the value into
|
||||
*/
|
||||
std::shared_ptr<nt::Value> SmartDashboard::GetValue(llvm::StringRef keyName) {
|
||||
return m_table->GetValue(keyName);
|
||||
@@ -99,19 +103,22 @@ std::shared_ptr<nt::Value> SmartDashboard::GetValue(llvm::StringRef keyName) {
|
||||
|
||||
/**
|
||||
* Maps the specified key to the specified value in this table.
|
||||
* The key can not be nullptr.
|
||||
*
|
||||
* The value can be retrieved by calling the get method with a key that is equal
|
||||
* to the original key.
|
||||
*
|
||||
* @param keyName the key
|
||||
* @param value the value
|
||||
* @param value the value
|
||||
*/
|
||||
void SmartDashboard::PutBoolean(llvm::StringRef keyName, bool value) {
|
||||
m_table->PutBoolean(keyName, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the value at the specified key. If the key is not found, returns the
|
||||
* default value.
|
||||
* Returns the value at the specified key.
|
||||
*
|
||||
* If the key is not found, returns the default value.
|
||||
*
|
||||
* @param keyName the key
|
||||
* @return the value
|
||||
*/
|
||||
@@ -121,19 +128,22 @@ bool SmartDashboard::GetBoolean(llvm::StringRef keyName, bool defaultValue) {
|
||||
|
||||
/**
|
||||
* Maps the specified key to the specified value in this table.
|
||||
* The key can not be nullptr.
|
||||
*
|
||||
* The value can be retrieved by calling the get method with a key that is equal
|
||||
* to the original key.
|
||||
*
|
||||
* @param keyName the key
|
||||
* @param value the value
|
||||
* @param value the value
|
||||
*/
|
||||
void SmartDashboard::PutNumber(llvm::StringRef keyName, double value) {
|
||||
m_table->PutNumber(keyName, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the value at the specified key. If the key is not found, returns the
|
||||
* default value.
|
||||
* Returns the value at the specified key.
|
||||
*
|
||||
* If the key is not found, returns the default value.
|
||||
*
|
||||
* @param keyName the key
|
||||
* @return the value
|
||||
*/
|
||||
@@ -143,19 +153,22 @@ double SmartDashboard::GetNumber(llvm::StringRef keyName, double defaultValue) {
|
||||
|
||||
/**
|
||||
* Maps the specified key to the specified value in this table.
|
||||
* Neither the key nor the value can be nullptr.
|
||||
*
|
||||
* The value can be retrieved by calling the get method with a key that is equal
|
||||
* to the original key.
|
||||
*
|
||||
* @param keyName the key
|
||||
* @param value the value
|
||||
* @param value the value
|
||||
*/
|
||||
void SmartDashboard::PutString(llvm::StringRef keyName, llvm::StringRef value) {
|
||||
m_table->PutString(keyName, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the value at the specified key. If the key is not found, returns the
|
||||
* default value.
|
||||
* Returns the value at the specified key.
|
||||
*
|
||||
* If the key is not found, returns the default value.
|
||||
*
|
||||
* @param keyName the key
|
||||
* @return the value
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user