/** * Maps the specified key to the specified value in this table. The key can not be null. The value * can be retrieved by calling the get method with a key that is equal to the original key. * * @param key the key * @param data the value * @throws IllegalArgumentException if key is null */ @SuppressWarnings("unchecked") public static void putData(String key, Sendable data) { ITable dataTable = table.getSubTable(key); dataTable.putString("~TYPE~", data.getSmartDashboardType()); data.initTable(dataTable); tablesToData.put(data, key); }
/** * Returns the value at the specified key. * * @param key the key * @return the value * @throws NetworkTableKeyNotDefined if there is no value mapped to by the key * @throws IllegalArgumentException if the key is null */ public static Sendable getData(String key) { ITable subtable = table.getSubTable(key); Object data = tablesToData.get(subtable); if (data == null) { throw new IllegalArgumentException("SmartDashboard data does not exist: " + key); } else { return (Sendable) data; } }