Use new NetworkTables across WPILib (C++ and Java).

Also make sure table listeners stop listening in their destructors.  This
might be better handled by moving the table itself into ITableListener and
providing cleanup functionality there.

A submodule is used to pull in ntcore.

Change-Id: I3031c1a768595cf0f8754c47e15cd423e2dbcce5
This commit is contained in:
Peter Johnson
2015-08-13 23:17:19 -07:00
committed by Brad Miller (WPI)
parent f65e697107
commit f89c5e150f
67 changed files with 512 additions and 1457 deletions

View File

@@ -6,7 +6,6 @@
/*----------------------------------------------------------------------------*/
#include "SmartDashboard/SendableChooser.h"
#include "networktables2/type/StringArray.h"
#include <stdio.h>
@@ -54,14 +53,14 @@ void *SendableChooser::GetSelected() {
}
void SendableChooser::InitTable(std::shared_ptr<ITable> subtable) {
StringArray keys;
std::vector<std::string> keys;
m_table = subtable;
if (m_table != nullptr) {
std::map<std::string, void *>::iterator iter;
for (iter = m_choices.begin(); iter != m_choices.end(); iter++) {
keys.add(iter->first);
keys.push_back(iter->first);
}
m_table->PutValue(kOptions, keys);
m_table->PutValue(kOptions, nt::Value::MakeStringArray(std::move(keys)));
m_table->PutString(kDefault, m_defaultChoice);
}
}