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

Commit

Permalink
Move NetworkTable into nt namespace, with a shim. (#211)
Browse files Browse the repository at this point in the history
Defining NAMESPACED_NT will disable the shim.
  • Loading branch information
PeterJohnson authored Aug 4, 2017
1 parent 5df7463 commit 8209ba8
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/main/native/cpp/networktables/NetworkTable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
15 changes: 12 additions & 3 deletions src/main/native/include/networktables/NetworkTable.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@

#include "tables/ITable.h"

namespace nt {

/**
* A network table that knows its subtable path.
*/
Expand Down Expand Up @@ -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<nt::Value> value) override;
bool PutValue(llvm::StringRef key, std::shared_ptr<Value> value) override;

/**
* Gets the current value in the table, setting it if it does not exist.
Expand All @@ -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<nt::Value> defaultValue) override;
llvm::StringRef key, std::shared_ptr<Value> defaultValue) override;

/**
* Gets the value associated with a key as an object
Expand All @@ -561,12 +563,19 @@ class NetworkTable : public ITable {
* @return the value associated with the given key, or nullptr if the key
* does not exist
*/
std::shared_ptr<nt::Value> GetValue(llvm::StringRef key) const override;
std::shared_ptr<Value> GetValue(llvm::StringRef key) const override;

/**
* Gets the full path of this table.
*/
llvm::StringRef GetPath() const override;
};

} // namespace nt

// For backwards compatability
#ifndef NAMESPACED_NT
using nt::NetworkTable; // NOLINT
#endif

#endif // NETWORKTABLE_H_

0 comments on commit 8209ba8

Please sign in to comment.