14 #include "llvm/StringRef.h" 16 #include "networktables/NetworkTableType.h" 17 #include "networktables/NetworkTableValue.h" 18 #include "networktables/RpcCall.h" 20 #include "ntcore_cpp.h" 27 class NetworkTableInstance;
35 enum Flags { kPersistent = NT_PERSISTENT };
52 explicit operator bool()
const {
return m_handle != 0; }
82 NetworkTableType
GetType()
const;
107 std::shared_ptr<Value>
GetValue()
const;
125 double GetDouble(
double defaultValue)
const;
244 bool SetValue(std::shared_ptr<Value> value);
419 unsigned int flags)
const;
432 return m_handle == oth.m_handle;
437 return !(*
this == oth);
447 #include "networktables/NetworkTableEntry.inl" 449 #endif // NT_ENTRY_H_ bool Exists() const
Determines if the entry currently exists.
Definition: NetworkTableEntry.inl:20
EntryInfo GetInfo() const
Gets combined information about the entry.
Definition: NetworkTableEntry.inl:40
void ForceSetDoubleArray(ArrayRef< double > value)
Sets the entry's value.
Definition: NetworkTableEntry.inl:184
void CreateRpc(std::function< void(const RpcAnswer &answer)> callback)
Create a callback-based RPC entry point.
Definition: NetworkTableEntry.inl:211
void RemoveListener(NT_EntryListener entry_listener)
Remove an entry listener.
Definition: NetworkTableEntry.inl:226
void ClearFlags(unsigned int flags)
Clears flags.
Definition: NetworkTableEntry.inl:197
bool operator==(const NetworkTableEntry &oth) const
Equality operator.
Definition: NetworkTableEntry.h:431
void ForceSetBooleanArray(ArrayRef< int > value)
Sets the entry's value.
Definition: NetworkTableEntry.inl:180
NetworkTables Remote Procedure Call.
Definition: RpcCall.h:21
unsigned long long GetLastChange() const
Gets the last time the entry's value was changed.
Definition: NetworkTableEntry.inl:36
NT_EntryListener AddListener(std::function< void(const EntryNotification &event)> callback, unsigned int flags) const
Add a listener for changes to this entry.
Definition: NetworkTableEntry.inl:220
std::vector< std::string > GetStringArray(ArrayRef< std::string > defaultValue) const
Gets the entry's value as a string array.
Definition: NetworkTableEntry.inl:86
std::string GetName() const
Gets the name of the entry (the key).
Definition: NetworkTableEntry.inl:24
NetworkTableInstance GetInstance() const
Gets the instance for the entry.
Definition: NetworkTableEntry.cpp:14
NetworkTables Remote Procedure Call (Server Side)
Definition: ntcore_cpp.h:120
NetworkTableEntry()
Construct invalid instance.
Definition: NetworkTableEntry.inl:13
NetworkTableType GetType() const
Gets the type of the entry.
Definition: NetworkTableEntry.inl:28
void ForceSetValue(std::shared_ptr< Value > value)
Sets the entry's value.
Definition: NetworkTableEntry.inl:160
void Delete()
Deletes the entry.
Definition: NetworkTableEntry.inl:209
bool SetDefaultStringArray(ArrayRef< std::string > defaultValue)
Sets the entry's value if it does not exist.
Definition: NetworkTableEntry.inl:123
bool SetDefaultDouble(double defaultValue)
Sets the entry's value if it does not exist.
Definition: NetworkTableEntry.inl:101
NetworkTables Entry Notification.
Definition: ntcore_cpp.h:165
void ForceSetString(StringRef value)
Sets the entry's value.
Definition: NetworkTableEntry.inl:172
RpcCall CallRpc(StringRef params)
Call a RPC function.
Definition: NetworkTableEntry.inl:216
std::string GetRaw(StringRef defaultValue) const
Gets the entry's value as a raw.
Definition: NetworkTableEntry.inl:66
void ForceSetRaw(StringRef value)
Sets the entry's value.
Definition: NetworkTableEntry.inl:176
void ForceSetBoolean(bool value)
Sets the entry's value.
Definition: NetworkTableEntry.inl:164
void ClearPersistent()
Stop making value persistent through program restarts.
Definition: NetworkTableEntry.inl:203
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory)...
Definition: ArrayRef.h:32
NetworkTables Instance.
Definition: NetworkTableInstance.h:59
void ForceSetStringArray(ArrayRef< std::string > value)
Sets the entry's value.
Definition: NetworkTableEntry.inl:188
void SetPersistent()
Make value persistent through program restarts.
Definition: NetworkTableEntry.inl:201
bool SetBoolean(bool value)
Sets the entry's value.
Definition: NetworkTableEntry.inl:132
bool SetRaw(StringRef value)
Sets the entry's value.
Definition: NetworkTableEntry.inl:144
std::string GetString(StringRef defaultValue) const
Gets the entry's value as a string.
Definition: NetworkTableEntry.inl:60
bool operator!=(const NetworkTableEntry &oth) const
Inequality operator.
Definition: NetworkTableEntry.h:436
bool SetDefaultBooleanArray(ArrayRef< int > defaultValue)
Sets the entry's value if it does not exist.
Definition: NetworkTableEntry.inl:113
Definition: IEntryNotifier.h:15
NetworkTables Entry Information.
Definition: ntcore_cpp.h:30
std::vector< int > GetBooleanArray(ArrayRef< int > defaultValue) const
Gets the entry's value as a boolean array.
Definition: NetworkTableEntry.inl:72
bool SetDefaultString(StringRef defaultValue)
Sets the entry's value if it does not exist.
Definition: NetworkTableEntry.inl:105
bool SetString(StringRef value)
Sets the entry's value.
Definition: NetworkTableEntry.inl:140
unsigned int GetFlags() const
Returns the flags.
Definition: NetworkTableEntry.inl:32
bool SetValue(std::shared_ptr< Value > value)
Sets the entry's value.
Definition: NetworkTableEntry.inl:128
void CreatePolledRpc()
Create a polled RPC entry point.
std::shared_ptr< Value > GetValue() const
Gets the entry's value.
Definition: NetworkTableEntry.inl:44
void ForceSetDouble(double value)
Sets the entry's value.
Definition: NetworkTableEntry.inl:168
double GetDouble(double defaultValue) const
Gets the entry's value as a double.
Definition: NetworkTableEntry.inl:54
bool SetStringArray(ArrayRef< std::string > value)
Sets the entry's value.
Definition: NetworkTableEntry.inl:156
Flags
Flag values (as returned by getFlags()).
Definition: NetworkTableEntry.h:35
bool SetDefaultDoubleArray(ArrayRef< double > defaultValue)
Sets the entry's value if it does not exist.
Definition: NetworkTableEntry.inl:118
bool SetDefaultValue(std::shared_ptr< Value > value)
Sets the entry's value if it does not exist.
Definition: NetworkTableEntry.inl:93
bool SetDefaultBoolean(bool defaultValue)
Sets the entry's value if it does not exist.
Definition: NetworkTableEntry.inl:97
bool GetBoolean(bool defaultValue) const
Gets the entry's value as a boolean.
Definition: NetworkTableEntry.inl:48
NT_Entry GetHandle() const
Gets the native handle for the entry.
Definition: NetworkTableEntry.inl:18
bool SetDouble(double value)
Sets the entry's value.
Definition: NetworkTableEntry.inl:136
bool SetDefaultRaw(StringRef defaultValue)
Sets the entry's value if it does not exist.
Definition: NetworkTableEntry.inl:109
NetworkTables Entry.
Definition: NetworkTableEntry.h:30
bool IsPersistent() const
Returns whether the value is persistent through program restarts.
Definition: NetworkTableEntry.inl:205
bool SetBooleanArray(ArrayRef< int > value)
Sets the entry's value.
Definition: NetworkTableEntry.inl:148
std::vector< double > GetDoubleArray(ArrayRef< double > defaultValue) const
Gets the entry's value as a double array.
Definition: NetworkTableEntry.inl:79
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:42
void SetFlags(unsigned int flags)
Sets flags.
Definition: NetworkTableEntry.inl:193
bool SetDoubleArray(ArrayRef< double > value)
Sets the entry's value.
Definition: NetworkTableEntry.inl:152