mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-07-01 02:41:48 +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
@@ -20,7 +20,7 @@ class NamedSendable : public Sendable {
|
||||
public:
|
||||
/**
|
||||
* @return the name of the subtable of SmartDashboard that the Sendable object
|
||||
* will use
|
||||
* will use
|
||||
*/
|
||||
virtual std::string GetName() const = 0;
|
||||
};
|
||||
|
||||
@@ -8,8 +8,8 @@
|
||||
#ifndef __SMART_DASHBOARD_DATA__
|
||||
#define __SMART_DASHBOARD_DATA__
|
||||
|
||||
#include <string>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include "tables/ITable.h"
|
||||
|
||||
class Sendable {
|
||||
@@ -27,7 +27,7 @@ class Sendable {
|
||||
|
||||
/**
|
||||
* @return the string representation of the named data type that will be used
|
||||
* by the smart dashboard for this sendable
|
||||
* by the smart dashboard for this sendable
|
||||
*/
|
||||
virtual std::string GetSmartDashboardType() const = 0;
|
||||
};
|
||||
|
||||
@@ -8,26 +8,22 @@
|
||||
#ifndef __SENDABLE_CHOOSER_H__
|
||||
#define __SENDABLE_CHOOSER_H__
|
||||
|
||||
#include "SmartDashboard/Sendable.h"
|
||||
#include "tables/ITable.h"
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include "SmartDashboard/Sendable.h"
|
||||
#include "tables/ITable.h"
|
||||
|
||||
/**
|
||||
* The {@link SendableChooser} class is a useful tool for presenting a selection
|
||||
* of options
|
||||
* to the {@link SmartDashboard}.
|
||||
* of options to the {@link SmartDashboard}.
|
||||
*
|
||||
* <p>For instance, you may wish to be able to select between multiple
|
||||
* autonomous modes.
|
||||
* You can do this by putting every possible {@link Command} you want to run as
|
||||
* an autonomous into
|
||||
* a {@link SendableChooser} and then put it into the {@link SmartDashboard} to
|
||||
* have a list of options
|
||||
* appear on the laptop. Once autonomous starts, simply ask the {@link
|
||||
* SendableChooser} what the selected
|
||||
* value is.</p>
|
||||
* autonomous modes. You can do this by putting every possible {@link Command}
|
||||
* you want to run as an autonomous into a {@link SendableChooser} and then put
|
||||
* it into the {@link SmartDashboard} to have a list of options appear on the
|
||||
* laptop. Once autonomous starts, simply ask the {@link SendableChooser} what
|
||||
* the selected value is.</p>
|
||||
*
|
||||
* @see SmartDashboard
|
||||
*/
|
||||
@@ -35,9 +31,9 @@ class SendableChooser : public Sendable {
|
||||
public:
|
||||
virtual ~SendableChooser() = default;
|
||||
|
||||
void AddObject(const std::string &name, void *object);
|
||||
void AddDefault(const std::string &name, void *object);
|
||||
void *GetSelected();
|
||||
void AddObject(const std::string& name, void* object);
|
||||
void AddDefault(const std::string& name, void* object);
|
||||
void* GetSelected();
|
||||
|
||||
virtual void InitTable(std::shared_ptr<ITable> subtable);
|
||||
virtual std::shared_ptr<ITable> GetTable() const;
|
||||
@@ -45,7 +41,7 @@ class SendableChooser : public Sendable {
|
||||
|
||||
private:
|
||||
std::string m_defaultChoice;
|
||||
std::map<std::string, void *> m_choices;
|
||||
std::map<std::string, void*> m_choices;
|
||||
std::shared_ptr<ITable> m_table;
|
||||
};
|
||||
|
||||
|
||||
@@ -8,20 +8,20 @@
|
||||
#ifndef __SMART_DASHBOARD_H__
|
||||
#define __SMART_DASHBOARD_H__
|
||||
|
||||
#include "SensorBase.h"
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include "SmartDashboard/Sendable.h"
|
||||
#include "SensorBase.h"
|
||||
#include "SmartDashboard/NamedSendable.h"
|
||||
#include "SmartDashboard/Sendable.h"
|
||||
#include "tables/ITable.h"
|
||||
|
||||
class SmartDashboard : public SensorBase {
|
||||
public:
|
||||
static void init();
|
||||
|
||||
static void PutData(llvm::StringRef key, Sendable *data);
|
||||
static void PutData(NamedSendable *value);
|
||||
static Sendable *GetData(llvm::StringRef keyName);
|
||||
static void PutData(llvm::StringRef key, Sendable* data);
|
||||
static void PutData(NamedSendable* value);
|
||||
static Sendable* GetData(llvm::StringRef keyName);
|
||||
|
||||
static void PutBoolean(llvm::StringRef keyName, bool value);
|
||||
static bool GetBoolean(llvm::StringRef keyName, bool defaultValue);
|
||||
@@ -44,11 +44,10 @@ class SmartDashboard : public SensorBase {
|
||||
static std::shared_ptr<ITable> m_table;
|
||||
|
||||
/**
|
||||
* A map linking tables in the SmartDashboard to the {@link
|
||||
* SmartDashboardData} objects
|
||||
* they came from.
|
||||
* A map linking tables in the SmartDashboard to the
|
||||
* {@link SmartDashboardData} objects they came from.
|
||||
*/
|
||||
static std::map<std::shared_ptr<ITable> , Sendable *> m_tablesToData;
|
||||
static std::map<std::shared_ptr<ITable>, Sendable*> m_tablesToData;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user