mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-07-02 02:51:42 +00:00
Make NetworkTable constructor private/package-private. (#253)
Users should be using either NetworkTableInstance.getTable() or NetworkTable.getSubTable().
This commit is contained in:
@@ -124,7 +124,7 @@ std::shared_ptr<NetworkTable> NetworkTable::GetTable(StringRef key) {
|
||||
return NetworkTableInstance::GetDefault().GetTable(key);
|
||||
}
|
||||
|
||||
NetworkTable::NetworkTable(NT_Inst inst, StringRef path)
|
||||
NetworkTable::NetworkTable(NT_Inst inst, StringRef path, const private_init&)
|
||||
: m_inst(inst), m_path(path) {}
|
||||
|
||||
NetworkTable::~NetworkTable() {
|
||||
@@ -282,7 +282,7 @@ std::shared_ptr<NetworkTable> NetworkTable::GetSubTable(StringRef key) const {
|
||||
llvm::SmallString<128> path(m_path);
|
||||
path += PATH_SEPARATOR_CHAR;
|
||||
path += key;
|
||||
return std::make_shared<NetworkTable>(m_inst, path);
|
||||
return std::make_shared<NetworkTable>(m_inst, path, private_init{});
|
||||
}
|
||||
|
||||
bool NetworkTable::ContainsKey(StringRef key) const {
|
||||
|
||||
@@ -13,14 +13,17 @@ using namespace nt;
|
||||
std::shared_ptr<NetworkTable> NetworkTableInstance::GetTable(
|
||||
StringRef key) const {
|
||||
if (key.empty() || key == "/") {
|
||||
return std::make_shared<NetworkTable>(m_handle, "");
|
||||
return std::make_shared<NetworkTable>(m_handle, "",
|
||||
NetworkTable::private_init{});
|
||||
} else if (key[0] == NetworkTable::PATH_SEPARATOR_CHAR) {
|
||||
return std::make_shared<NetworkTable>(m_handle, key);
|
||||
return std::make_shared<NetworkTable>(m_handle, key,
|
||||
NetworkTable::private_init{});
|
||||
} else {
|
||||
llvm::SmallString<128> path;
|
||||
path += NetworkTable::PATH_SEPARATOR_CHAR;
|
||||
path += key;
|
||||
return std::make_shared<NetworkTable>(m_handle, path);
|
||||
return std::make_shared<NetworkTable>(m_handle, path,
|
||||
NetworkTable::private_init{});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user