Expose ITable paths (#200)

Closes #196
This commit is contained in:
Sam Carlberg
2017-05-27 00:02:45 -04:00
committed by Peter Johnson
parent 3d2f41d081
commit 417cf33f90
5 changed files with 31 additions and 0 deletions

View File

@@ -562,6 +562,11 @@ class NetworkTable : public ITable {
* does not exist
*/
std::shared_ptr<nt::Value> GetValue(llvm::StringRef key) const override;
/**
* Gets the full path of this table.
*/
llvm::StringRef GetPath() const override;
};
#endif // NETWORKTABLE_H_

View File

@@ -482,6 +482,12 @@ class ITable {
* @param listener the listener to be removed
*/
virtual void RemoveTableListener(ITableListener* listener) = 0;
/**
* Gets the full path of this table.
*/
virtual llvm::StringRef GetPath() const = 0;
};
#endif // ITABLE_H_

View File

@@ -1102,4 +1102,14 @@ public class NetworkTable implements ITable, IRemote {
public double getDouble(String key, double defaultValue) {
return getNumber(key, defaultValue);
}
/**
* {@inheritDoc}
* @return
*/
@Override
public String getPath() {
return path;
}
}

View File

@@ -625,4 +625,10 @@ public interface ITable {
*/
@Deprecated
public double getDouble(String key, double defaultValue);
/**
* Gets the full path of this table.
*/
public String getPath();
}

View File

@@ -576,3 +576,7 @@ std::shared_ptr<nt::Value> NetworkTable::GetValue(StringRef key) const {
path += key;
return nt::GetEntryValue(path);
}
StringRef NetworkTable::GetPath() const {
return m_path;
}