Skip to content
This repository has been archived by the owner on Sep 21, 2020. It is now read-only.

Commit

Permalink
Expose ITable paths (#200)
Browse files Browse the repository at this point in the history
Closes #196
  • Loading branch information
SamCarlberg authored and PeterJohnson committed May 27, 2017
1 parent 3d2f41d commit 417cf33
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 0 deletions.
5 changes: 5 additions & 0 deletions include/networktables/NetworkTable.h
Original file line number Diff line number Diff line change
Expand Up @@ -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_
6 changes: 6 additions & 0 deletions include/tables/ITable.h
Original file line number Diff line number Diff line change
Expand Up @@ -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_
10 changes: 10 additions & 0 deletions java/src/edu/wpi/first/wpilibj/networktables/NetworkTable.java
Original file line number Diff line number Diff line change
Expand Up @@ -1102,4 +1102,14 @@ public double getDouble(String key) throws TableKeyNotDefinedException {
public double getDouble(String key, double defaultValue) {
return getNumber(key, defaultValue);
}

/**
* {@inheritDoc}
* @return
*/
@Override
public String getPath() {
return path;
}

}
6 changes: 6 additions & 0 deletions java/src/edu/wpi/first/wpilibj/tables/ITable.java
Original file line number Diff line number Diff line change
Expand Up @@ -625,4 +625,10 @@ public int getInt(String key, int defaultValue)
*/
@Deprecated
public double getDouble(String key, double defaultValue);

/**
* Gets the full path of this table.
*/
public String getPath();

}
4 changes: 4 additions & 0 deletions src/networktables/NetworkTable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

0 comments on commit 417cf33

Please sign in to comment.