WPILib Reorganization

This is a major restructuring of the WPILib repository to simply build
procedures and remove the remnants of Maven from everything except the
eclipse plugins. Gradle files have been largely simplified or rewritten,
taking advantage of splitting up parts of the build into separate build
files for ease of reading.

The eclipse plugins are now in a separate project, as is ntcore. All
dependencies are resolved via Maven dependencies, with the
Jenkins-maintained WPILib repo. Project structures have also been
simplified: we no longer have separate subprojects inside wpilibc and
wpilibj. Where possible, these changes hav been done with git renames,
to make sure we still have full history for all repositories. Other
unrelated subprojects have also been broken out: OutlineViewer is now a
separate project.

Change-Id: Ib4e2a6e1a2f66427a14f16612b0e0d69ed661878
This commit is contained in:
Fredric Silberberg
2015-09-24 20:26:49 -04:00
parent c20d34c2b6
commit 6d854afb0e
1769 changed files with 2278 additions and 333177 deletions

View File

@@ -0,0 +1,72 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) FIRST 2011. All Rights Reserved.
*/
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in $(WIND_BASE)/WPILib. */
/*----------------------------------------------------------------------------*/
#include "SmartDashboard/SendableChooser.h"
#include <stdio.h>
static const std::string kDefault = "default";
static const std::string kOptions = "options";
static const std::string kSelected = "selected";
/**
* Adds the given object to the list of options. On the {@link SmartDashboard}
* on the desktop,
* the object will appear as the given name.
* @param name the name of the option
* @param object the option
*/
void SendableChooser::AddObject(const std::string &name, void *object) {
m_choices[name] = object;
}
/**
* Add the given object to the list of options and marks it as the default.
* Functionally, this is very close to {@link SendableChooser#AddObject(const
* char *name, void *object) AddObject(...)}
* except that it will use this as the default option if none other is
* explicitly selected.
* @param name the name of the option
* @param object the option
*/
void SendableChooser::AddDefault(const std::string &name, void *object) {
m_defaultChoice = name;
AddObject(name, object);
}
/**
* Returns the selected option. If there is none selected, it will return the
* default. If there is none selected
* and no default, then it will return {@code nullptr}.
* @return the option selected
*/
void *SendableChooser::GetSelected() {
std::string selected = m_table->GetString(kSelected, m_defaultChoice);
if (selected == "")
return nullptr;
else
return m_choices[selected];
}
void SendableChooser::InitTable(std::shared_ptr<ITable> subtable) {
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.push_back(iter->first);
}
m_table->PutValue(kOptions, nt::Value::MakeStringArray(std::move(keys)));
m_table->PutString(kDefault, m_defaultChoice);
}
}
std::shared_ptr<ITable> SendableChooser::GetTable() const { return m_table; }
std::string SendableChooser::GetSmartDashboardType() const {
return "String Chooser";
}