Remove GetTable from wpilibc Sendable interface.

This allows nearly all m_table member variables to be removed.
This commit is contained in:
Peter Johnson
2017-09-02 00:35:30 -07:00
parent 040a8c6bcc
commit 0d4fde17e0
57 changed files with 87 additions and 259 deletions

View File

@@ -218,7 +218,6 @@ void Scheduler::ResetAll() {
m_buttons.clear();
m_additions.clear();
m_commands.clear();
m_table = nullptr;
m_namesEntry = nt::NetworkTableEntry();
m_idsEntry = nt::NetworkTableEntry();
m_cancelEntry = nt::NetworkTableEntry();
@@ -229,7 +228,7 @@ void Scheduler::ResetAll() {
* SmartDashboard.
*/
void Scheduler::UpdateTable() {
if (m_table != nullptr) {
if (m_cancelEntry && m_namesEntry && m_idsEntry) {
// Get the list of possible commands to cancel
auto new_toCancel = m_cancelEntry.GetValue();
if (new_toCancel)
@@ -277,11 +276,10 @@ std::string Scheduler::GetType() const { return "Scheduler"; }
std::string Scheduler::GetSmartDashboardType() const { return "Scheduler"; }
void Scheduler::InitTable(std::shared_ptr<nt::NetworkTable> subTable) {
m_table = subTable;
if (m_table) {
m_namesEntry = m_table->GetEntry("Names");
m_idsEntry = m_table->GetEntry("Ids");
m_cancelEntry = m_table->GetEntry("Cancel");
if (subTable) {
m_namesEntry = subTable->GetEntry("Names");
m_idsEntry = subTable->GetEntry("Ids");
m_cancelEntry = subTable->GetEntry("Cancel");
m_namesEntry.SetStringArray(commands);
m_idsEntry.SetDoubleArray(ids);
m_cancelEntry.SetDoubleArray(toCancel);
@@ -291,7 +289,3 @@ void Scheduler::InitTable(std::shared_ptr<nt::NetworkTable> subTable) {
m_cancelEntry = nt::NetworkTableEntry();
}
}
std::shared_ptr<nt::NetworkTable> Scheduler::GetTable() const {
return m_table;
}