From 8209ba8a008399b94abe999738f2fbe7e86b773f Mon Sep 17 00:00:00 2001 From: Peter Johnson Date: Fri, 4 Aug 2017 10:32:33 -0500 Subject: [PATCH] Move NetworkTable into nt namespace, with a shim. (#211) Defining NAMESPACED_NT will disable the shim. --- .../native/cpp/networktables/NetworkTable.cpp | 1 + .../native/include/networktables/NetworkTable.h | 15 ++++++++++++--- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/main/native/cpp/networktables/NetworkTable.cpp b/src/main/native/cpp/networktables/NetworkTable.cpp index 984d186d24..4437de060b 100644 --- a/src/main/native/cpp/networktables/NetworkTable.cpp +++ b/src/main/native/cpp/networktables/NetworkTable.cpp @@ -10,6 +10,7 @@ #include "ntcore.h" using llvm::StringRef; +using nt::NetworkTable; const char NetworkTable::PATH_SEPARATOR_CHAR = '/'; std::string NetworkTable::s_persistent_filename = "networktables.ini"; diff --git a/src/main/native/include/networktables/NetworkTable.h b/src/main/native/include/networktables/NetworkTable.h index 683d6e2be8..0b9ae61753 100644 --- a/src/main/native/include/networktables/NetworkTable.h +++ b/src/main/native/include/networktables/NetworkTable.h @@ -14,6 +14,8 @@ #include "tables/ITable.h" +namespace nt { + /** * A network table that knows its subtable path. */ @@ -543,7 +545,7 @@ class NetworkTable : public ITable { * @param value the value that will be assigned * @return False if the table key already exists with a different type */ - bool PutValue(llvm::StringRef key, std::shared_ptr value) override; + bool PutValue(llvm::StringRef key, std::shared_ptr value) override; /** * Gets the current value in the table, setting it if it does not exist. @@ -552,7 +554,7 @@ class NetworkTable : public ITable { * @returns False if the table key exists with a different type */ virtual bool SetDefaultValue( - llvm::StringRef key, std::shared_ptr defaultValue) override; + llvm::StringRef key, std::shared_ptr defaultValue) override; /** * Gets the value associated with a key as an object @@ -561,7 +563,7 @@ class NetworkTable : public ITable { * @return the value associated with the given key, or nullptr if the key * does not exist */ - std::shared_ptr GetValue(llvm::StringRef key) const override; + std::shared_ptr GetValue(llvm::StringRef key) const override; /** * Gets the full path of this table. @@ -569,4 +571,11 @@ class NetworkTable : public ITable { llvm::StringRef GetPath() const override; }; +} // namespace nt + +// For backwards compatability +#ifndef NAMESPACED_NT +using nt::NetworkTable; // NOLINT +#endif + #endif // NETWORKTABLE_H_