[ntcore] Remove "using wpi" from nt namespace

This removes the nt::ArrayRef, nt::StringRef, and nt::Twine aliases.
This commit is contained in:
Peter Johnson
2021-04-04 12:40:46 -07:00
parent 79267f9e60
commit 397e569aaf
34 changed files with 460 additions and 437 deletions

View File

@@ -23,10 +23,6 @@
namespace nt {
using wpi::ArrayRef;
using wpi::StringRef;
using wpi::Twine;
class NetworkTableInstance;
/**
@@ -58,7 +54,7 @@ class NetworkTable final {
* @param key key
* @return base name
*/
static StringRef BasenameKey(StringRef key);
static wpi::StringRef BasenameKey(wpi::StringRef key);
/**
* Normalizes an network table key to contain no consecutive slashes and
@@ -76,12 +72,12 @@ class NetworkTable final {
* with a leading slash
* @return normalized key
*/
static std::string NormalizeKey(const Twine& key,
static std::string NormalizeKey(const wpi::Twine& key,
bool withLeadingSlash = true);
static StringRef NormalizeKey(const Twine& key,
wpi::SmallVectorImpl<char>& buf,
bool withLeadingSlash = true);
static wpi::StringRef NormalizeKey(const wpi::Twine& key,
wpi::SmallVectorImpl<char>& buf,
bool withLeadingSlash = true);
/**
* Gets a list of the names of all the super tables of a given key. For
@@ -91,13 +87,13 @@ class NetworkTable final {
* @param key the key
* @return List of super tables
*/
static std::vector<std::string> GetHierarchy(const Twine& key);
static std::vector<std::string> GetHierarchy(const wpi::Twine& key);
/**
* Constructor. Use NetworkTableInstance::GetTable() or GetSubTable()
* instead.
*/
NetworkTable(NT_Inst inst, const Twine& path, const private_init&);
NetworkTable(NT_Inst inst, const wpi::Twine& path, const private_init&);
virtual ~NetworkTable();
/**
@@ -118,7 +114,7 @@ class NetworkTable final {
* @param key the key name
* @return Network table entry.
*/
NetworkTableEntry GetEntry(const Twine& key) const;
NetworkTableEntry GetEntry(const wpi::Twine& key) const;
/**
* Listen to keys only within this table.
@@ -138,7 +134,7 @@ class NetworkTable final {
* @param flags EntryListenerFlags bitmask
* @return Listener handle
*/
NT_EntryListener AddEntryListener(const Twine& key,
NT_EntryListener AddEntryListener(const wpi::Twine& key,
TableEntryListener listener,
unsigned int flags) const;
@@ -175,7 +171,7 @@ class NetworkTable final {
* @param key the key name
* @return the networktable to be returned
*/
std::shared_ptr<NetworkTable> GetSubTable(const Twine& key) const;
std::shared_ptr<NetworkTable> GetSubTable(const wpi::Twine& key) const;
/**
* Determines whether the given key is in this table.
@@ -183,7 +179,7 @@ class NetworkTable final {
* @param key the key to search for
* @return true if the table as a value assigned to the given key
*/
bool ContainsKey(const Twine& key) const;
bool ContainsKey(const wpi::Twine& key) const;
/**
* Determines whether there exists a non-empty subtable for this key
@@ -193,7 +189,7 @@ class NetworkTable final {
* @return true if there is a subtable with the key which contains at least
* one key/subtable of its own
*/
bool ContainsSubTable(const Twine& key) const;
bool ContainsSubTable(const wpi::Twine& key) const;
/**
* Gets all keys in the table (not including sub-tables).
@@ -215,7 +211,7 @@ class NetworkTable final {
*
* @param key the key to make persistent
*/
void SetPersistent(StringRef key);
void SetPersistent(wpi::StringRef key);
/**
* Stop making a key's value persistent through program restarts.
@@ -223,7 +219,7 @@ class NetworkTable final {
*
* @param key the key name
*/
void ClearPersistent(StringRef key);
void ClearPersistent(wpi::StringRef key);
/**
* Returns whether the value is persistent through program restarts.
@@ -231,7 +227,7 @@ class NetworkTable final {
*
* @param key the key name
*/
bool IsPersistent(StringRef key) const;
bool IsPersistent(wpi::StringRef key) const;
/**
* Sets flags on the specified key in this table. The key can
@@ -240,7 +236,7 @@ class NetworkTable final {
* @param key the key name
* @param flags the flags to set (bitmask)
*/
void SetFlags(StringRef key, unsigned int flags);
void SetFlags(wpi::StringRef key, unsigned int flags);
/**
* Clears flags on the specified key in this table. The key can
@@ -249,7 +245,7 @@ class NetworkTable final {
* @param key the key name
* @param flags the flags to clear (bitmask)
*/
void ClearFlags(StringRef key, unsigned int flags);
void ClearFlags(wpi::StringRef key, unsigned int flags);
/**
* Returns the flags for the specified key.
@@ -257,14 +253,14 @@ class NetworkTable final {
* @param key the key name
* @return the flags, or 0 if the key is not defined
*/
unsigned int GetFlags(StringRef key) const;
unsigned int GetFlags(wpi::StringRef key) const;
/**
* Deletes the specified key in this table.
*
* @param key the key name
*/
void Delete(const Twine& key);
void Delete(const wpi::Twine& key);
/**
* Put a number in the table
@@ -273,7 +269,7 @@ class NetworkTable final {
* @param value the value that will be assigned
* @return False if the table key already exists with a different type
*/
bool PutNumber(StringRef key, double value);
bool PutNumber(wpi::StringRef key, double value);
/**
* Gets the current value in the table, setting it if it does not exist.
@@ -282,7 +278,7 @@ class NetworkTable final {
* @param defaultValue the default value to set if key doesn't exist.
* @returns False if the table key exists with a different type
*/
bool SetDefaultNumber(StringRef key, double defaultValue);
bool SetDefaultNumber(wpi::StringRef key, double defaultValue);
/**
* Gets the number associated with the given name.
@@ -292,7 +288,7 @@ class NetworkTable final {
* @return the value associated with the given key or the given default value
* if there is no value associated with the key
*/
double GetNumber(StringRef key, double defaultValue) const;
double GetNumber(wpi::StringRef key, double defaultValue) const;
/**
* Put a string in the table
@@ -301,7 +297,7 @@ class NetworkTable final {
* @param value the value that will be assigned
* @return False if the table key already exists with a different type
*/
bool PutString(StringRef key, StringRef value);
bool PutString(wpi::StringRef key, wpi::StringRef value);
/**
* Gets the current value in the table, setting it if it does not exist.
@@ -310,7 +306,7 @@ class NetworkTable final {
* @param defaultValue the default value to set if key doesn't exist.
* @returns False if the table key exists with a different type
*/
bool SetDefaultString(StringRef key, StringRef defaultValue);
bool SetDefaultString(wpi::StringRef key, wpi::StringRef defaultValue);
/**
* Gets the string associated with the given name. If the key does not
@@ -321,7 +317,7 @@ class NetworkTable final {
* @return the value associated with the given key or the given default value
* if there is no value associated with the key
*/
std::string GetString(StringRef key, StringRef defaultValue) const;
std::string GetString(wpi::StringRef key, wpi::StringRef defaultValue) const;
/**
* Put a boolean in the table
@@ -330,7 +326,7 @@ class NetworkTable final {
* @param value the value that will be assigned
* @return False if the table key already exists with a different type
*/
bool PutBoolean(StringRef key, bool value);
bool PutBoolean(wpi::StringRef key, bool value);
/**
* Gets the current value in the table, setting it if it does not exist.
@@ -339,7 +335,7 @@ class NetworkTable final {
* @param defaultValue the default value to set if key doesn't exist.
* @returns False if the table key exists with a different type
*/
bool SetDefaultBoolean(StringRef key, bool defaultValue);
bool SetDefaultBoolean(wpi::StringRef key, bool defaultValue);
/**
* Gets the boolean associated with the given name. If the key does not
@@ -350,7 +346,7 @@ class NetworkTable final {
* @return the value associated with the given key or the given default value
* if there is no value associated with the key
*/
bool GetBoolean(StringRef key, bool defaultValue) const;
bool GetBoolean(wpi::StringRef key, bool defaultValue) const;
/**
* Put a boolean array in the table
@@ -363,7 +359,7 @@ class NetworkTable final {
* std::vector<bool> is special-cased in C++. 0 is false, any
* non-zero value is true.
*/
bool PutBooleanArray(StringRef key, ArrayRef<int> value);
bool PutBooleanArray(wpi::StringRef key, wpi::ArrayRef<int> value);
/**
* Gets the current value in the table, setting it if it does not exist.
@@ -372,7 +368,8 @@ class NetworkTable final {
* @param defaultValue the default value to set if key doesn't exist.
* @return False if the table key exists with a different type
*/
bool SetDefaultBooleanArray(StringRef key, ArrayRef<int> defaultValue);
bool SetDefaultBooleanArray(wpi::StringRef key,
wpi::ArrayRef<int> defaultValue);
/**
* Returns the boolean array the key maps to. If the key does not exist or is
@@ -390,8 +387,8 @@ class NetworkTable final {
* because std::vector<bool> is special-cased in C++. 0 is false, any
* non-zero value is true.
*/
std::vector<int> GetBooleanArray(StringRef key,
ArrayRef<int> defaultValue) const;
std::vector<int> GetBooleanArray(wpi::StringRef key,
wpi::ArrayRef<int> defaultValue) const;
/**
* Put a number array in the table
@@ -400,7 +397,7 @@ class NetworkTable final {
* @param value the value that will be assigned
* @return False if the table key already exists with a different type
*/
bool PutNumberArray(StringRef key, ArrayRef<double> value);
bool PutNumberArray(wpi::StringRef key, wpi::ArrayRef<double> value);
/**
* Gets the current value in the table, setting it if it does not exist.
@@ -409,7 +406,8 @@ class NetworkTable final {
* @param defaultValue the default value to set if key doesn't exist.
* @returns False if the table key exists with a different type
*/
bool SetDefaultNumberArray(StringRef key, ArrayRef<double> defaultValue);
bool SetDefaultNumberArray(wpi::StringRef key,
wpi::ArrayRef<double> defaultValue);
/**
* Returns the number array the key maps to. If the key does not exist or is
@@ -423,8 +421,8 @@ class NetworkTable final {
* @note This makes a copy of the array. If the overhead of this is a
* concern, use GetValue() instead.
*/
std::vector<double> GetNumberArray(StringRef key,
ArrayRef<double> defaultValue) const;
std::vector<double> GetNumberArray(wpi::StringRef key,
wpi::ArrayRef<double> defaultValue) const;
/**
* Put a string array in the table
@@ -433,7 +431,7 @@ class NetworkTable final {
* @param value the value that will be assigned
* @return False if the table key already exists with a different type
*/
bool PutStringArray(StringRef key, ArrayRef<std::string> value);
bool PutStringArray(wpi::StringRef key, wpi::ArrayRef<std::string> value);
/**
* Gets the current value in the table, setting it if it does not exist.
@@ -442,7 +440,8 @@ class NetworkTable final {
* @param defaultValue the default value to set if key doesn't exist.
* @returns False if the table key exists with a different type
*/
bool SetDefaultStringArray(StringRef key, ArrayRef<std::string> defaultValue);
bool SetDefaultStringArray(wpi::StringRef key,
wpi::ArrayRef<std::string> defaultValue);
/**
* Returns the string array the key maps to. If the key does not exist or is
@@ -457,7 +456,7 @@ class NetworkTable final {
* concern, use GetValue() instead.
*/
std::vector<std::string> GetStringArray(
StringRef key, ArrayRef<std::string> defaultValue) const;
wpi::StringRef key, wpi::ArrayRef<std::string> defaultValue) const;
/**
* Put a raw value (byte array) in the table
@@ -466,7 +465,7 @@ class NetworkTable final {
* @param value the value that will be assigned
* @return False if the table key already exists with a different type
*/
bool PutRaw(StringRef key, StringRef value);
bool PutRaw(wpi::StringRef key, wpi::StringRef value);
/**
* Gets the current value in the table, setting it if it does not exist.
@@ -475,7 +474,7 @@ class NetworkTable final {
* @param defaultValue the default value to set if key doesn't exist.
* @return False if the table key exists with a different type
*/
bool SetDefaultRaw(StringRef key, StringRef defaultValue);
bool SetDefaultRaw(wpi::StringRef key, wpi::StringRef defaultValue);
/**
* Returns the raw value (byte array) the key maps to. If the key does not
@@ -489,7 +488,7 @@ class NetworkTable final {
* @note This makes a copy of the raw contents. If the overhead of this is a
* concern, use GetValue() instead.
*/
std::string GetRaw(StringRef key, StringRef defaultValue) const;
std::string GetRaw(wpi::StringRef key, wpi::StringRef defaultValue) const;
/**
* Put a value in the table
@@ -498,7 +497,7 @@ class NetworkTable final {
* @param value the value that will be assigned
* @return False if the table key already exists with a different type
*/
bool PutValue(const Twine& key, std::shared_ptr<Value> value);
bool PutValue(const wpi::Twine& key, std::shared_ptr<Value> value);
/**
* Gets the current value in the table, setting it if it does not exist.
@@ -507,7 +506,8 @@ class NetworkTable final {
* @param defaultValue the default value to set if key doesn't exist.
* @return False if the table key exists with a different type
*/
bool SetDefaultValue(const Twine& key, std::shared_ptr<Value> defaultValue);
bool SetDefaultValue(const wpi::Twine& key,
std::shared_ptr<Value> defaultValue);
/**
* Gets the value associated with a key as an object
@@ -516,14 +516,14 @@ class NetworkTable final {
* @return the value associated with the given key, or nullptr if the key
* does not exist
*/
std::shared_ptr<Value> GetValue(const Twine& key) const;
std::shared_ptr<Value> GetValue(const wpi::Twine& key) const;
/**
* Gets the full path of this table. Does not include the trailing "/".
*
* @return The path (e.g "", "/foo").
*/
StringRef GetPath() const;
wpi::StringRef GetPath() const;
/**
* Save table values to a file. The file format used is identical to
@@ -532,7 +532,7 @@ class NetworkTable final {
* @param filename filename
* @return error string, or nullptr if successful
*/
const char* SaveEntries(const Twine& filename) const;
const char* SaveEntries(const wpi::Twine& filename) const;
/**
* Load table values from a file. The file format used is identical to
@@ -543,7 +543,7 @@ class NetworkTable final {
* @return error string, or nullptr if successful
*/
const char* LoadEntries(
const Twine& filename,
const wpi::Twine& filename,
std::function<void(size_t line, const char* msg)> warn);
};

View File

@@ -23,10 +23,6 @@
namespace nt {
using wpi::ArrayRef;
using wpi::StringRef;
using wpi::Twine;
class NetworkTableInstance;
/**
@@ -147,7 +143,7 @@ class NetworkTableEntry final {
* @param defaultValue the value to be returned if no value is found
* @return the entry's value or the given default value
*/
std::string GetString(StringRef defaultValue) const;
std::string GetString(wpi::StringRef defaultValue) const;
/**
* Gets the entry's value as a raw. If the entry does not exist or is of
@@ -156,7 +152,7 @@ class NetworkTableEntry final {
* @param defaultValue the value to be returned if no value is found
* @return the entry's value or the given default value
*/
std::string GetRaw(StringRef defaultValue) const;
std::string GetRaw(wpi::StringRef defaultValue) const;
/**
* Gets the entry's value as a boolean array. If the entry does not exist
@@ -172,7 +168,7 @@ class NetworkTableEntry final {
* because std::vector<bool> is special-cased in C++. 0 is false, any
* non-zero value is true.
*/
std::vector<int> GetBooleanArray(ArrayRef<int> defaultValue) const;
std::vector<int> GetBooleanArray(wpi::ArrayRef<int> defaultValue) const;
/**
* Gets the entry's value as a boolean array. If the entry does not exist
@@ -201,7 +197,7 @@ class NetworkTableEntry final {
* @note This makes a copy of the array. If the overhead of this is a
* concern, use GetValue() instead.
*/
std::vector<double> GetDoubleArray(ArrayRef<double> defaultValue) const;
std::vector<double> GetDoubleArray(wpi::ArrayRef<double> defaultValue) const;
/**
* Gets the entry's value as a double array. If the entry does not exist
@@ -227,7 +223,7 @@ class NetworkTableEntry final {
* concern, use GetValue() instead.
*/
std::vector<std::string> GetStringArray(
ArrayRef<std::string> defaultValue) const;
wpi::ArrayRef<std::string> defaultValue) const;
/**
* Gets the entry's value as a string array. If the entry does not exist
@@ -272,7 +268,7 @@ class NetworkTableEntry final {
* @param defaultValue the default value to set
* @return False if the entry exists with a different type
*/
bool SetDefaultString(const Twine& defaultValue);
bool SetDefaultString(const wpi::Twine& defaultValue);
/**
* Sets the entry's value if it does not exist.
@@ -280,7 +276,7 @@ class NetworkTableEntry final {
* @param defaultValue the default value to set
* @return False if the entry exists with a different type
*/
bool SetDefaultRaw(StringRef defaultValue);
bool SetDefaultRaw(wpi::StringRef defaultValue);
/**
* Sets the entry's value if it does not exist.
@@ -288,7 +284,7 @@ class NetworkTableEntry final {
* @param defaultValue the default value to set
* @return False if the entry exists with a different type
*/
bool SetDefaultBooleanArray(ArrayRef<int> defaultValue);
bool SetDefaultBooleanArray(wpi::ArrayRef<int> defaultValue);
/**
* Sets the entry's value if it does not exist.
@@ -304,7 +300,7 @@ class NetworkTableEntry final {
* @param defaultValue the default value to set
* @return False if the entry exists with a different type
*/
bool SetDefaultDoubleArray(ArrayRef<double> defaultValue);
bool SetDefaultDoubleArray(wpi::ArrayRef<double> defaultValue);
/**
* Sets the entry's value if it does not exist.
@@ -320,7 +316,7 @@ class NetworkTableEntry final {
* @param defaultValue the default value to set
* @return False if the entry exists with a different type
*/
bool SetDefaultStringArray(ArrayRef<std::string> defaultValue);
bool SetDefaultStringArray(wpi::ArrayRef<std::string> defaultValue);
/**
* Sets the entry's value if it does not exist.
@@ -360,7 +356,7 @@ class NetworkTableEntry final {
* @param value the value to set
* @return False if the entry exists with a different type
*/
bool SetString(const Twine& value);
bool SetString(const wpi::Twine& value);
/**
* Sets the entry's value.
@@ -368,7 +364,7 @@ class NetworkTableEntry final {
* @param value the value to set
* @return False if the entry exists with a different type
*/
bool SetRaw(StringRef value);
bool SetRaw(wpi::StringRef value);
/**
* Sets the entry's value.
@@ -376,7 +372,7 @@ class NetworkTableEntry final {
* @param value the value to set
* @return False if the entry exists with a different type
*/
bool SetBooleanArray(ArrayRef<bool> value);
bool SetBooleanArray(wpi::ArrayRef<bool> value);
/**
* Sets the entry's value.
@@ -392,7 +388,7 @@ class NetworkTableEntry final {
* @param value the value to set
* @return False if the entry exists with a different type
*/
bool SetBooleanArray(ArrayRef<int> value);
bool SetBooleanArray(wpi::ArrayRef<int> value);
/**
* Sets the entry's value.
@@ -408,7 +404,7 @@ class NetworkTableEntry final {
* @param value the value to set
* @return False if the entry exists with a different type
*/
bool SetDoubleArray(ArrayRef<double> value);
bool SetDoubleArray(wpi::ArrayRef<double> value);
/**
* Sets the entry's value.
@@ -424,7 +420,7 @@ class NetworkTableEntry final {
* @param value the value to set
* @return False if the entry exists with a different type
*/
bool SetStringArray(ArrayRef<std::string> value);
bool SetStringArray(wpi::ArrayRef<std::string> value);
/**
* Sets the entry's value.
@@ -464,7 +460,7 @@ class NetworkTableEntry final {
*
* @param value the value to set
*/
void ForceSetString(const Twine& value);
void ForceSetString(const wpi::Twine& value);
/**
* Sets the entry's value. If the value is of different type, the type is
@@ -472,7 +468,7 @@ class NetworkTableEntry final {
*
* @param value the value to set
*/
void ForceSetRaw(StringRef value);
void ForceSetRaw(wpi::StringRef value);
/**
* Sets the entry's value. If the value is of different type, the type is
@@ -480,7 +476,7 @@ class NetworkTableEntry final {
*
* @param value the value to set
*/
void ForceSetBooleanArray(ArrayRef<bool> value);
void ForceSetBooleanArray(wpi::ArrayRef<bool> value);
/**
* Sets the entry's value. If the value is of different type, the type is
@@ -496,7 +492,7 @@ class NetworkTableEntry final {
*
* @param value the value to set
*/
void ForceSetBooleanArray(ArrayRef<int> value);
void ForceSetBooleanArray(wpi::ArrayRef<int> value);
/**
* Sets the entry's value. If the value is of different type, the type is
@@ -512,7 +508,7 @@ class NetworkTableEntry final {
*
* @param value the value to set
*/
void ForceSetDoubleArray(ArrayRef<double> value);
void ForceSetDoubleArray(wpi::ArrayRef<double> value);
/**
* Sets the entry's value. If the value is of different type, the type is
@@ -528,7 +524,7 @@ class NetworkTableEntry final {
*
* @param value the value to set
*/
void ForceSetStringArray(ArrayRef<std::string> value);
void ForceSetStringArray(wpi::ArrayRef<std::string> value);
/**
* Sets the entry's value. If the value is of different type, the type is
@@ -600,7 +596,7 @@ class NetworkTableEntry final {
* @param params parameter
* @return RPC call object.
*/
RpcCall CallRpc(StringRef params);
RpcCall CallRpc(wpi::StringRef params);
/**
* Add a listener for changes to this entry.

View File

@@ -66,7 +66,8 @@ inline double NetworkTableEntry::GetDouble(double defaultValue) const {
return value->GetDouble();
}
inline std::string NetworkTableEntry::GetString(StringRef defaultValue) const {
inline std::string NetworkTableEntry::GetString(
wpi::StringRef defaultValue) const {
auto value = GetEntryValue(m_handle);
if (!value || value->type() != NT_STRING) {
return defaultValue;
@@ -74,7 +75,8 @@ inline std::string NetworkTableEntry::GetString(StringRef defaultValue) const {
return value->GetString();
}
inline std::string NetworkTableEntry::GetRaw(StringRef defaultValue) const {
inline std::string NetworkTableEntry::GetRaw(
wpi::StringRef defaultValue) const {
auto value = GetEntryValue(m_handle);
if (!value || value->type() != NT_RAW) {
return defaultValue;
@@ -83,7 +85,7 @@ inline std::string NetworkTableEntry::GetRaw(StringRef defaultValue) const {
}
inline std::vector<int> NetworkTableEntry::GetBooleanArray(
ArrayRef<int> defaultValue) const {
wpi::ArrayRef<int> defaultValue) const {
auto value = GetEntryValue(m_handle);
if (!value || value->type() != NT_BOOLEAN_ARRAY) {
return defaultValue;
@@ -98,7 +100,7 @@ inline std::vector<int> NetworkTableEntry::GetBooleanArray(
}
inline std::vector<double> NetworkTableEntry::GetDoubleArray(
ArrayRef<double> defaultValue) const {
wpi::ArrayRef<double> defaultValue) const {
auto value = GetEntryValue(m_handle);
if (!value || value->type() != NT_DOUBLE_ARRAY) {
return defaultValue;
@@ -113,7 +115,7 @@ inline std::vector<double> NetworkTableEntry::GetDoubleArray(
}
inline std::vector<std::string> NetworkTableEntry::GetStringArray(
ArrayRef<std::string> defaultValue) const {
wpi::ArrayRef<std::string> defaultValue) const {
auto value = GetEntryValue(m_handle);
if (!value || value->type() != NT_STRING_ARRAY) {
return defaultValue;
@@ -139,16 +141,17 @@ inline bool NetworkTableEntry::SetDefaultDouble(double defaultValue) {
return SetDefaultEntryValue(m_handle, Value::MakeDouble(defaultValue));
}
inline bool NetworkTableEntry::SetDefaultString(const Twine& defaultValue) {
inline bool NetworkTableEntry::SetDefaultString(
const wpi::Twine& defaultValue) {
return SetDefaultEntryValue(m_handle, Value::MakeString(defaultValue));
}
inline bool NetworkTableEntry::SetDefaultRaw(StringRef defaultValue) {
inline bool NetworkTableEntry::SetDefaultRaw(wpi::StringRef defaultValue) {
return SetDefaultEntryValue(m_handle, Value::MakeRaw(defaultValue));
}
inline bool NetworkTableEntry::SetDefaultBooleanArray(
ArrayRef<int> defaultValue) {
wpi::ArrayRef<int> defaultValue) {
return SetDefaultEntryValue(m_handle, Value::MakeBooleanArray(defaultValue));
}
@@ -158,7 +161,7 @@ inline bool NetworkTableEntry::SetDefaultBooleanArray(
}
inline bool NetworkTableEntry::SetDefaultDoubleArray(
ArrayRef<double> defaultValue) {
wpi::ArrayRef<double> defaultValue) {
return SetDefaultEntryValue(m_handle, Value::MakeDoubleArray(defaultValue));
}
@@ -168,7 +171,7 @@ inline bool NetworkTableEntry::SetDefaultDoubleArray(
}
inline bool NetworkTableEntry::SetDefaultStringArray(
ArrayRef<std::string> defaultValue) {
wpi::ArrayRef<std::string> defaultValue) {
return SetDefaultEntryValue(m_handle, Value::MakeStringArray(defaultValue));
}
@@ -189,15 +192,15 @@ inline bool NetworkTableEntry::SetDouble(double value) {
return SetEntryValue(m_handle, Value::MakeDouble(value));
}
inline bool NetworkTableEntry::SetString(const Twine& value) {
inline bool NetworkTableEntry::SetString(const wpi::Twine& value) {
return SetEntryValue(m_handle, Value::MakeString(value));
}
inline bool NetworkTableEntry::SetRaw(StringRef value) {
inline bool NetworkTableEntry::SetRaw(wpi::StringRef value) {
return SetEntryValue(m_handle, Value::MakeRaw(value));
}
inline bool NetworkTableEntry::SetBooleanArray(ArrayRef<bool> value) {
inline bool NetworkTableEntry::SetBooleanArray(wpi::ArrayRef<bool> value) {
return SetEntryValue(m_handle, Value::MakeBooleanArray(value));
}
@@ -206,7 +209,7 @@ inline bool NetworkTableEntry::SetBooleanArray(
return SetEntryValue(m_handle, Value::MakeBooleanArray(value));
}
inline bool NetworkTableEntry::SetBooleanArray(ArrayRef<int> value) {
inline bool NetworkTableEntry::SetBooleanArray(wpi::ArrayRef<int> value) {
return SetEntryValue(m_handle, Value::MakeBooleanArray(value));
}
@@ -215,7 +218,7 @@ inline bool NetworkTableEntry::SetBooleanArray(
return SetEntryValue(m_handle, Value::MakeBooleanArray(value));
}
inline bool NetworkTableEntry::SetDoubleArray(ArrayRef<double> value) {
inline bool NetworkTableEntry::SetDoubleArray(wpi::ArrayRef<double> value) {
return SetEntryValue(m_handle, Value::MakeDoubleArray(value));
}
@@ -224,7 +227,8 @@ inline bool NetworkTableEntry::SetDoubleArray(
return SetEntryValue(m_handle, Value::MakeDoubleArray(value));
}
inline bool NetworkTableEntry::SetStringArray(ArrayRef<std::string> value) {
inline bool NetworkTableEntry::SetStringArray(
wpi::ArrayRef<std::string> value) {
return SetEntryValue(m_handle, Value::MakeStringArray(value));
}
@@ -245,15 +249,15 @@ inline void NetworkTableEntry::ForceSetDouble(double value) {
SetEntryTypeValue(m_handle, Value::MakeDouble(value));
}
inline void NetworkTableEntry::ForceSetString(const Twine& value) {
inline void NetworkTableEntry::ForceSetString(const wpi::Twine& value) {
SetEntryTypeValue(m_handle, Value::MakeString(value));
}
inline void NetworkTableEntry::ForceSetRaw(StringRef value) {
inline void NetworkTableEntry::ForceSetRaw(wpi::StringRef value) {
SetEntryTypeValue(m_handle, Value::MakeRaw(value));
}
inline void NetworkTableEntry::ForceSetBooleanArray(ArrayRef<bool> value) {
inline void NetworkTableEntry::ForceSetBooleanArray(wpi::ArrayRef<bool> value) {
SetEntryTypeValue(m_handle, Value::MakeBooleanArray(value));
}
@@ -262,7 +266,7 @@ inline void NetworkTableEntry::ForceSetBooleanArray(
SetEntryTypeValue(m_handle, Value::MakeBooleanArray(value));
}
inline void NetworkTableEntry::ForceSetBooleanArray(ArrayRef<int> value) {
inline void NetworkTableEntry::ForceSetBooleanArray(wpi::ArrayRef<int> value) {
SetEntryTypeValue(m_handle, Value::MakeBooleanArray(value));
}
@@ -271,7 +275,8 @@ inline void NetworkTableEntry::ForceSetBooleanArray(
SetEntryTypeValue(m_handle, Value::MakeBooleanArray(value));
}
inline void NetworkTableEntry::ForceSetDoubleArray(ArrayRef<double> value) {
inline void NetworkTableEntry::ForceSetDoubleArray(
wpi::ArrayRef<double> value) {
SetEntryTypeValue(m_handle, Value::MakeDoubleArray(value));
}
@@ -281,7 +286,7 @@ inline void NetworkTableEntry::ForceSetDoubleArray(
}
inline void NetworkTableEntry::ForceSetStringArray(
ArrayRef<std::string> value) {
wpi::ArrayRef<std::string> value) {
SetEntryTypeValue(m_handle, Value::MakeStringArray(value));
}
@@ -316,10 +321,10 @@ inline void NetworkTableEntry::Delete() {
inline void NetworkTableEntry::CreateRpc(
std::function<void(const RpcAnswer& answer)> callback) {
::nt::CreateRpc(m_handle, StringRef("\0", 1), callback);
::nt::CreateRpc(m_handle, wpi::StringRef("\0", 1), callback);
}
inline RpcCall NetworkTableEntry::CallRpc(StringRef params) {
inline RpcCall NetworkTableEntry::CallRpc(wpi::StringRef params) {
return RpcCall{m_handle, ::nt::CallRpc(m_handle, params)};
}

View File

@@ -22,10 +22,6 @@
namespace nt {
using wpi::ArrayRef;
using wpi::StringRef;
using wpi::Twine;
/**
* NetworkTables Instance.
*
@@ -135,7 +131,7 @@ class NetworkTableInstance final {
* @param name Key
* @return Network table entry.
*/
NetworkTableEntry GetEntry(const Twine& name);
NetworkTableEntry GetEntry(const wpi::Twine& name);
/**
* Get entries starting with the given prefix.
@@ -148,7 +144,7 @@ class NetworkTableInstance final {
* @param types bitmask of types; 0 is treated as a "don't care"
* @return Array of entries.
*/
std::vector<NetworkTableEntry> GetEntries(const Twine& prefix,
std::vector<NetworkTableEntry> GetEntries(const wpi::Twine& prefix,
unsigned int types);
/**
@@ -162,7 +158,7 @@ class NetworkTableInstance final {
* @param types bitmask of types; 0 is treated as a "don't care"
* @return Array of entry information.
*/
std::vector<EntryInfo> GetEntryInfo(const Twine& prefix,
std::vector<EntryInfo> GetEntryInfo(const wpi::Twine& prefix,
unsigned int types) const;
/**
@@ -171,7 +167,7 @@ class NetworkTableInstance final {
* @param key the key name
* @return The network table
*/
std::shared_ptr<NetworkTable> GetTable(const Twine& key) const;
std::shared_ptr<NetworkTable> GetTable(const wpi::Twine& key) const;
/**
* Deletes ALL keys in ALL subtables (except persistent values).
@@ -193,7 +189,7 @@ class NetworkTableInstance final {
* @return Listener handle
*/
NT_EntryListener AddEntryListener(
const Twine& prefix,
const wpi::Twine& prefix,
std::function<void(const EntryNotification& event)> callback,
unsigned int flags) const;
@@ -287,7 +283,7 @@ class NetworkTableInstance final {
*
* @param name identity to advertise
*/
void SetNetworkIdentity(const Twine& name);
void SetNetworkIdentity(const wpi::Twine& name);
/**
* Get the current network mode.
@@ -318,7 +314,7 @@ class NetworkTableInstance final {
* address (UTF-8 string, null terminated)
* @param port port to communicate over
*/
void StartServer(const Twine& persist_filename = "networktables.ini",
void StartServer(const wpi::Twine& persist_filename = "networktables.ini",
const char* listen_address = "",
unsigned int port = kDefaultPort);
@@ -346,7 +342,8 @@ class NetworkTableInstance final {
*
* @param servers array of server name and port pairs
*/
void StartClient(ArrayRef<std::pair<StringRef, unsigned int>> servers);
void StartClient(
wpi::ArrayRef<std::pair<wpi::StringRef, unsigned int>> servers);
/**
* Starts a client using the specified servers and port. The
@@ -355,7 +352,7 @@ class NetworkTableInstance final {
* @param servers array of server names
* @param port port to communicate over
*/
void StartClient(ArrayRef<StringRef> servers,
void StartClient(wpi::ArrayRef<wpi::StringRef> servers,
unsigned int port = kDefaultPort);
/**
@@ -386,7 +383,8 @@ class NetworkTableInstance final {
*
* @param servers array of server name and port pairs
*/
void SetServer(ArrayRef<std::pair<StringRef, unsigned int>> servers);
void SetServer(
wpi::ArrayRef<std::pair<wpi::StringRef, unsigned int>> servers);
/**
* Sets server addresses and port for client (without restarting client).
@@ -395,7 +393,8 @@ class NetworkTableInstance final {
* @param servers array of server names
* @param port port to communicate over
*/
void SetServer(ArrayRef<StringRef> servers, unsigned int port = kDefaultPort);
void SetServer(wpi::ArrayRef<wpi::StringRef> servers,
unsigned int port = kDefaultPort);
/**
* Sets server addresses and port for client (without restarting client).
@@ -466,7 +465,7 @@ class NetworkTableInstance final {
* @param filename filename
* @return error string, or nullptr if successful
*/
const char* SavePersistent(const Twine& filename) const;
const char* SavePersistent(const wpi::Twine& filename) const;
/**
* Load persistent values from a file. The server automatically does this
@@ -478,7 +477,7 @@ class NetworkTableInstance final {
* @return error string, or nullptr if successful
*/
const char* LoadPersistent(
const Twine& filename,
const wpi::Twine& filename,
std::function<void(size_t line, const char* msg)> warn);
/**
@@ -489,7 +488,8 @@ class NetworkTableInstance final {
* @param prefix save only keys starting with this prefix
* @return error string, or nullptr if successful
*/
const char* SaveEntries(const Twine& filename, const Twine& prefix) const;
const char* SaveEntries(const wpi::Twine& filename,
const wpi::Twine& prefix) const;
/**
* Load table values from a file. The file format used is identical to
@@ -501,7 +501,7 @@ class NetworkTableInstance final {
* @return error string, or nullptr if successful
*/
const char* LoadEntries(
const Twine& filename, const Twine& prefix,
const wpi::Twine& filename, const wpi::Twine& prefix,
std::function<void(size_t line, const char* msg)> warn);
/** @} */

View File

@@ -35,12 +35,13 @@ inline NT_Inst NetworkTableInstance::GetHandle() const {
return m_handle;
}
inline NetworkTableEntry NetworkTableInstance::GetEntry(const Twine& name) {
inline NetworkTableEntry NetworkTableInstance::GetEntry(
const wpi::Twine& name) {
return NetworkTableEntry{::nt::GetEntry(m_handle, name)};
}
inline std::vector<NetworkTableEntry> NetworkTableInstance::GetEntries(
const Twine& prefix, unsigned int types) {
const wpi::Twine& prefix, unsigned int types) {
std::vector<NetworkTableEntry> entries;
for (auto entry : ::nt::GetEntries(m_handle, prefix, types)) {
entries.emplace_back(entry);
@@ -49,7 +50,7 @@ inline std::vector<NetworkTableEntry> NetworkTableInstance::GetEntries(
}
inline std::vector<EntryInfo> NetworkTableInstance::GetEntryInfo(
const Twine& prefix, unsigned int types) const {
const wpi::Twine& prefix, unsigned int types) const {
return ::nt::GetEntryInfo(m_handle, prefix, types);
}
@@ -80,7 +81,7 @@ inline bool NetworkTableInstance::WaitForRpcCallQueue(double timeout) {
return ::nt::WaitForRpcCallQueue(m_handle, timeout);
}
inline void NetworkTableInstance::SetNetworkIdentity(const Twine& name) {
inline void NetworkTableInstance::SetNetworkIdentity(const wpi::Twine& name) {
::nt::SetNetworkIdentity(m_handle, name);
}
@@ -96,9 +97,9 @@ inline void NetworkTableInstance::StopLocal() {
::nt::StopLocal(m_handle);
}
inline void NetworkTableInstance::StartServer(const Twine& persist_filename,
const char* listen_address,
unsigned int port) {
inline void NetworkTableInstance::StartServer(
const wpi::Twine& persist_filename, const char* listen_address,
unsigned int port) {
::nt::StartServer(m_handle, persist_filename, listen_address, port);
}
@@ -116,7 +117,7 @@ inline void NetworkTableInstance::StartClient(const char* server_name,
}
inline void NetworkTableInstance::StartClient(
ArrayRef<std::pair<StringRef, unsigned int>> servers) {
wpi::ArrayRef<std::pair<wpi::StringRef, unsigned int>> servers) {
::nt::StartClient(m_handle, servers);
}
@@ -135,7 +136,7 @@ inline void NetworkTableInstance::SetServer(const char* server_name,
}
inline void NetworkTableInstance::SetServer(
ArrayRef<std::pair<StringRef, unsigned int>> servers) {
wpi::ArrayRef<std::pair<wpi::StringRef, unsigned int>> servers) {
::nt::SetServer(m_handle, servers);
}
@@ -170,23 +171,23 @@ inline bool NetworkTableInstance::IsConnected() const {
}
inline const char* NetworkTableInstance::SavePersistent(
const Twine& filename) const {
const wpi::Twine& filename) const {
return ::nt::SavePersistent(m_handle, filename);
}
inline const char* NetworkTableInstance::LoadPersistent(
const Twine& filename,
const wpi::Twine& filename,
std::function<void(size_t line, const char* msg)> warn) {
return ::nt::LoadPersistent(m_handle, filename, warn);
}
inline const char* NetworkTableInstance::SaveEntries(
const Twine& filename, const Twine& prefix) const {
const wpi::Twine& filename, const wpi::Twine& prefix) const {
return ::nt::SaveEntries(m_handle, filename, prefix);
}
inline const char* NetworkTableInstance::LoadEntries(
const Twine& filename, const Twine& prefix,
const wpi::Twine& filename, const wpi::Twine& prefix,
std::function<void(size_t line, const char* msg)> warn) {
return ::nt::LoadEntries(m_handle, filename, prefix, warn);
}

View File

@@ -23,10 +23,6 @@
namespace nt {
using wpi::ArrayRef;
using wpi::StringRef;
using wpi::Twine;
/**
* A network table entry value.
* @ingroup ntcore_cpp_api
@@ -167,7 +163,7 @@ class Value final {
*
* @return The string value.
*/
StringRef GetString() const {
wpi::StringRef GetString() const {
assert(m_val.type == NT_STRING);
return m_string;
}
@@ -177,7 +173,7 @@ class Value final {
*
* @return The raw value.
*/
StringRef GetRaw() const {
wpi::StringRef GetRaw() const {
assert(m_val.type == NT_RAW);
return m_string;
}
@@ -187,7 +183,7 @@ class Value final {
*
* @return The rpc definition value.
*/
StringRef GetRpc() const {
wpi::StringRef GetRpc() const {
assert(m_val.type == NT_RPC);
return m_string;
}
@@ -197,10 +193,10 @@ class Value final {
*
* @return The boolean array value.
*/
ArrayRef<int> GetBooleanArray() const {
wpi::ArrayRef<int> GetBooleanArray() const {
assert(m_val.type == NT_BOOLEAN_ARRAY);
return ArrayRef<int>(m_val.data.arr_boolean.arr,
m_val.data.arr_boolean.size);
return wpi::ArrayRef<int>(m_val.data.arr_boolean.arr,
m_val.data.arr_boolean.size);
}
/**
@@ -208,10 +204,10 @@ class Value final {
*
* @return The double array value.
*/
ArrayRef<double> GetDoubleArray() const {
wpi::ArrayRef<double> GetDoubleArray() const {
assert(m_val.type == NT_DOUBLE_ARRAY);
return ArrayRef<double>(m_val.data.arr_double.arr,
m_val.data.arr_double.size);
return wpi::ArrayRef<double>(m_val.data.arr_double.arr,
m_val.data.arr_double.size);
}
/**
@@ -219,7 +215,7 @@ class Value final {
*
* @return The string array value.
*/
ArrayRef<std::string> GetStringArray() const {
wpi::ArrayRef<std::string> GetStringArray() const {
assert(m_val.type == NT_STRING_ARRAY);
return m_string_array;
}
@@ -267,7 +263,7 @@ class Value final {
* time)
* @return The entry value
*/
static std::shared_ptr<Value> MakeString(const Twine& value,
static std::shared_ptr<Value> MakeString(const wpi::Twine& value,
uint64_t time = 0) {
auto val = std::make_shared<Value>(NT_STRING, time, private_init());
val->m_string = value.str();
@@ -302,7 +298,8 @@ class Value final {
* time)
* @return The entry value
*/
static std::shared_ptr<Value> MakeRaw(StringRef value, uint64_t time = 0) {
static std::shared_ptr<Value> MakeRaw(wpi::StringRef value,
uint64_t time = 0) {
auto val = std::make_shared<Value>(NT_RAW, time, private_init());
val->m_string = value;
val->m_val.data.v_raw.str = const_cast<char*>(val->m_string.c_str());
@@ -336,7 +333,8 @@ class Value final {
* time)
* @return The entry value
*/
static std::shared_ptr<Value> MakeRpc(StringRef value, uint64_t time = 0) {
static std::shared_ptr<Value> MakeRpc(wpi::StringRef value,
uint64_t time = 0) {
auto val = std::make_shared<Value>(NT_RPC, time, private_init());
val->m_string = value;
val->m_val.data.v_raw.str = const_cast<char*>(val->m_string.c_str());
@@ -369,7 +367,7 @@ class Value final {
* time)
* @return The entry value
*/
static std::shared_ptr<Value> MakeBooleanArray(ArrayRef<bool> value,
static std::shared_ptr<Value> MakeBooleanArray(wpi::ArrayRef<bool> value,
uint64_t time = 0);
/**
@@ -394,7 +392,7 @@ class Value final {
* time)
* @return The entry value
*/
static std::shared_ptr<Value> MakeBooleanArray(ArrayRef<int> value,
static std::shared_ptr<Value> MakeBooleanArray(wpi::ArrayRef<int> value,
uint64_t time = 0);
/**
@@ -419,7 +417,7 @@ class Value final {
* time)
* @return The entry value
*/
static std::shared_ptr<Value> MakeDoubleArray(ArrayRef<double> value,
static std::shared_ptr<Value> MakeDoubleArray(wpi::ArrayRef<double> value,
uint64_t time = 0);
/**
@@ -443,8 +441,8 @@ class Value final {
* time)
* @return The entry value
*/
static std::shared_ptr<Value> MakeStringArray(ArrayRef<std::string> value,
uint64_t time = 0);
static std::shared_ptr<Value> MakeStringArray(
wpi::ArrayRef<std::string> value, uint64_t time = 0);
/**
* Creates a string array entry value.

View File

@@ -16,8 +16,6 @@ class NetworkTable;
class NetworkTableEntry;
class Value;
using wpi::StringRef;
/**
* A listener that listens to changes in values in a NetworkTable.
*
@@ -32,7 +30,7 @@ using wpi::StringRef;
*
* @ingroup ntcore_cpp_api
*/
typedef std::function<void(NetworkTable* table, StringRef name,
typedef std::function<void(NetworkTable* table, wpi::StringRef name,
NetworkTableEntry entry,
std::shared_ptr<Value> value, int flags)>
TableEntryListener;

View File

@@ -14,8 +14,6 @@ namespace nt {
class NetworkTable;
using wpi::StringRef;
/**
* A listener that listens to new sub-tables in a NetworkTable.
*
@@ -27,7 +25,7 @@ using wpi::StringRef;
*
* @ingroup ntcore_cpp_api
*/
typedef std::function<void(NetworkTable* parent, StringRef name,
typedef std::function<void(NetworkTable* parent, wpi::StringRef name,
std::shared_ptr<NetworkTable> table)>
TableListener;

View File

@@ -32,10 +32,6 @@ namespace nt {
* @{
*/
using wpi::ArrayRef;
using wpi::StringRef;
using wpi::Twine;
/** NetworkTables Entry Information */
struct EntryInfo {
/** Entry handle */
@@ -102,7 +98,7 @@ struct ConnectionInfo {
/** NetworkTables RPC Version 1 Definition Parameter */
struct RpcParamDef {
RpcParamDef() = default;
RpcParamDef(StringRef name_, std::shared_ptr<Value> def_value_)
RpcParamDef(wpi::StringRef name_, std::shared_ptr<Value> def_value_)
: name(name_), def_value(std::move(def_value_)) {}
std::string name;
@@ -112,7 +108,8 @@ struct RpcParamDef {
/** NetworkTables RPC Version 1 Definition Result */
struct RpcResultDef {
RpcResultDef() = default;
RpcResultDef(StringRef name_, NT_Type type_) : name(name_), type(type_) {}
RpcResultDef(wpi::StringRef name_, NT_Type type_)
: name(name_), type(type_) {}
std::string name;
NT_Type type;
@@ -130,8 +127,8 @@ struct RpcDefinition {
class RpcAnswer {
public:
RpcAnswer() = default;
RpcAnswer(NT_Entry entry_, NT_RpcCall call_, StringRef name_,
StringRef params_, ConnectionInfo conn_)
RpcAnswer(NT_Entry entry_, NT_RpcCall call_, wpi::StringRef name_,
wpi::StringRef params_, ConnectionInfo conn_)
: entry(entry_),
call(call_),
name(name_),
@@ -164,7 +161,7 @@ class RpcAnswer {
* @param result result raw data that will be provided to remote caller
* @return True if posting the response is valid, otherwise false
*/
bool PostResponse(StringRef result) const;
bool PostResponse(wpi::StringRef result) const;
friend void swap(RpcAnswer& first, RpcAnswer& second) {
using std::swap;
@@ -181,7 +178,7 @@ class EntryNotification {
public:
EntryNotification() = default;
EntryNotification(NT_EntryListener listener_, NT_Entry entry_,
StringRef name_, std::shared_ptr<Value> value_,
wpi::StringRef name_, std::shared_ptr<Value> value_,
unsigned int flags_)
: listener(listener_),
entry(entry_),
@@ -248,7 +245,7 @@ class LogMessage {
public:
LogMessage() = default;
LogMessage(NT_Logger logger_, unsigned int level_, const char* filename_,
unsigned int line_, StringRef message_)
unsigned int line_, wpi::StringRef message_)
: logger(logger_),
level(level_),
filename(filename_),
@@ -330,7 +327,7 @@ NT_Inst GetInstanceFromHandle(NT_Handle handle);
* @param name entry name (UTF-8 string)
* @return entry handle
*/
NT_Entry GetEntry(NT_Inst inst, const Twine& name);
NT_Entry GetEntry(NT_Inst inst, const wpi::Twine& name);
/**
* Get Entry Handles.
@@ -346,7 +343,7 @@ NT_Entry GetEntry(NT_Inst inst, const Twine& name);
* as a "don't care"
* @return Array of entry handles.
*/
std::vector<NT_Entry> GetEntries(NT_Inst inst, const Twine& prefix,
std::vector<NT_Entry> GetEntries(NT_Inst inst, const wpi::Twine& prefix,
unsigned int types);
/**
@@ -487,7 +484,7 @@ void DeleteAllEntries(NT_Inst inst);
* as a "don't care"
* @return Array of entry information.
*/
std::vector<EntryInfo> GetEntryInfo(NT_Inst inst, const Twine& prefix,
std::vector<EntryInfo> GetEntryInfo(NT_Inst inst, const wpi::Twine& prefix,
unsigned int types);
/**
@@ -519,7 +516,7 @@ EntryInfo GetEntryInfo(NT_Entry entry);
* @param flags update flags; for example, NT_NOTIFY_NEW if the key
* did not previously exist
*/
typedef std::function<void(NT_EntryListener entry_listener, StringRef name,
typedef std::function<void(NT_EntryListener entry_listener, wpi::StringRef name,
std::shared_ptr<Value> value, unsigned int flags)>
EntryListenerCallback;
@@ -533,7 +530,7 @@ typedef std::function<void(NT_EntryListener entry_listener, StringRef name,
* @return Listener handle
*/
NT_EntryListener AddEntryListener(
NT_Inst inst, const Twine& prefix,
NT_Inst inst, const wpi::Twine& prefix,
std::function<void(const EntryNotification& event)> callback,
unsigned int flags);
@@ -581,7 +578,7 @@ void DestroyEntryListenerPoller(NT_EntryListenerPoller poller);
* @return Listener handle
*/
NT_EntryListener AddPolledEntryListener(NT_EntryListenerPoller poller,
const Twine& prefix,
const wpi::Twine& prefix,
unsigned int flags);
/**
@@ -790,7 +787,7 @@ bool WaitForConnectionListenerQueue(NT_Inst inst, double timeout);
* @param callback callback function; note the callback function must call
* PostRpcResponse() to provide a response to the call
*/
void CreateRpc(NT_Entry entry, StringRef def,
void CreateRpc(NT_Entry entry, wpi::StringRef def,
std::function<void(const RpcAnswer& answer)> callback);
/**
@@ -823,7 +820,8 @@ void DestroyRpcCallPoller(NT_RpcCallPoller poller);
* @param def RPC definition
* @param poller poller handle
*/
void CreatePolledRpc(NT_Entry entry, StringRef def, NT_RpcCallPoller poller);
void CreatePolledRpc(NT_Entry entry, wpi::StringRef def,
NT_RpcCallPoller poller);
/**
* Get the next incoming RPC call. This blocks until the next incoming RPC
@@ -886,7 +884,7 @@ bool WaitForRpcCallQueue(NT_Inst inst, double timeout);
* @param result result raw data that will be provided to remote caller
* @return true if the response was posted, otherwise false
*/
bool PostRpcResponse(NT_Entry entry, NT_RpcCall call, StringRef result);
bool PostRpcResponse(NT_Entry entry, NT_RpcCall call, wpi::StringRef result);
/**
* Call a RPC function. May be used on either the client or server.
@@ -899,7 +897,7 @@ bool PostRpcResponse(NT_Entry entry, NT_RpcCall call, StringRef result);
* @return RPC call handle (for use with GetRpcResult() or
* CancelRpcResult()).
*/
NT_RpcCall CallRpc(NT_Entry entry, StringRef params);
NT_RpcCall CallRpc(NT_Entry entry, wpi::StringRef params);
/**
* Get the result (return value) of a RPC call. This function blocks until
@@ -950,7 +948,7 @@ std::string PackRpcDefinition(const RpcDefinition& def);
* @param def RPC version 1 definition (output)
* @return True if successfully unpacked, false otherwise.
*/
bool UnpackRpcDefinition(StringRef packed, RpcDefinition* def);
bool UnpackRpcDefinition(wpi::StringRef packed, RpcDefinition* def);
/**
* Pack RPC values as required for RPC version 1 definition messages.
@@ -958,7 +956,7 @@ bool UnpackRpcDefinition(StringRef packed, RpcDefinition* def);
* @param values array of values to pack
* @return Raw packed bytes.
*/
std::string PackRpcValues(ArrayRef<std::shared_ptr<Value>> values);
std::string PackRpcValues(wpi::ArrayRef<std::shared_ptr<Value>> values);
/**
* Unpack RPC values as required for RPC version 1 definition messages.
@@ -967,8 +965,8 @@ std::string PackRpcValues(ArrayRef<std::shared_ptr<Value>> values);
* @param types array of data types (as provided in the RPC definition)
* @return Array of values.
*/
std::vector<std::shared_ptr<Value>> UnpackRpcValues(StringRef packed,
ArrayRef<NT_Type> types);
std::vector<std::shared_ptr<Value>> UnpackRpcValues(
wpi::StringRef packed, wpi::ArrayRef<NT_Type> types);
/** @} */
@@ -985,7 +983,7 @@ std::vector<std::shared_ptr<Value>> UnpackRpcValues(StringRef packed,
* @param inst instance handle
* @param name identity to advertise
*/
void SetNetworkIdentity(NT_Inst inst, const Twine& name);
void SetNetworkIdentity(NT_Inst inst, const wpi::Twine& name);
/**
* Get the current network mode.
@@ -1018,7 +1016,7 @@ void StopLocal(NT_Inst inst);
* address. (UTF-8 string, null terminated)
* @param port port to communicate over.
*/
void StartServer(NT_Inst inst, const Twine& persist_filename,
void StartServer(NT_Inst inst, const wpi::Twine& persist_filename,
const char* listen_address, unsigned int port);
/**
@@ -1051,8 +1049,9 @@ void StartClient(NT_Inst inst, const char* server_name, unsigned int port);
* @param inst instance handle
* @param servers array of server name and port pairs
*/
void StartClient(NT_Inst inst,
ArrayRef<std::pair<StringRef, unsigned int>> servers);
void StartClient(
NT_Inst inst,
wpi::ArrayRef<std::pair<wpi::StringRef, unsigned int>> servers);
/**
* Starts a client using commonly known robot addresses for the specified
@@ -1088,7 +1087,7 @@ void SetServer(NT_Inst inst, const char* server_name, unsigned int port);
* @param servers array of server name and port pairs
*/
void SetServer(NT_Inst inst,
ArrayRef<std::pair<StringRef, unsigned int>> servers);
wpi::ArrayRef<std::pair<wpi::StringRef, unsigned int>> servers);
/**
* Sets server addresses and port for client (without restarting client).
@@ -1174,7 +1173,7 @@ bool IsConnected(NT_Inst inst);
* @param filename filename
* @return error string, or nullptr if successful
*/
const char* SavePersistent(NT_Inst inst, const Twine& filename);
const char* SavePersistent(NT_Inst inst, const wpi::Twine& filename);
/**
* Load persistent values from a file. The server automatically does this
@@ -1187,7 +1186,7 @@ const char* SavePersistent(NT_Inst inst, const Twine& filename);
* @return error string, or nullptr if successful
*/
const char* LoadPersistent(
NT_Inst inst, const Twine& filename,
NT_Inst inst, const wpi::Twine& filename,
std::function<void(size_t line, const char* msg)> warn);
/**
@@ -1199,8 +1198,8 @@ const char* LoadPersistent(
* @param prefix save only keys starting with this prefix
* @return error string, or nullptr if successful
*/
const char* SaveEntries(NT_Inst inst, const Twine& filename,
const Twine& prefix);
const char* SaveEntries(NT_Inst inst, const wpi::Twine& filename,
const wpi::Twine& prefix);
/**
* Load table values from a file. The file format used is identical to
@@ -1212,8 +1211,8 @@ const char* SaveEntries(NT_Inst inst, const Twine& filename,
* @param warn callback function for warnings
* @return error string, or nullptr if successful
*/
const char* LoadEntries(NT_Inst inst, const Twine& filename,
const Twine& prefix,
const char* LoadEntries(NT_Inst inst, const wpi::Twine& filename,
const wpi::Twine& prefix,
std::function<void(size_t line, const char* msg)> warn);
/** @} */
@@ -1340,7 +1339,7 @@ bool WaitForLoggerQueue(NT_Inst inst, double timeout);
/** @} */
/** @} */
inline bool RpcAnswer::PostResponse(StringRef result) const {
inline bool RpcAnswer::PostResponse(wpi::StringRef result) const {
auto ret = PostRpcResponse(entry, call, result);
call = 0;
return ret;