15 #include "ErrorBase.h"
16 #include "networktables/NetworkTable.h"
17 #include "tables/ITableListener.h"
39 std::vector<std::string>
GetKeys();
40 std::string
GetString(llvm::StringRef key, llvm::StringRef defaultValue =
"");
41 int GetInt(llvm::StringRef key,
int defaultValue = 0);
42 double GetDouble(llvm::StringRef key,
double defaultValue = 0.0);
43 float GetFloat(llvm::StringRef key,
float defaultValue = 0.0);
44 bool GetBoolean(llvm::StringRef key,
bool defaultValue =
false);
45 int64_t
GetLong(llvm::StringRef key, int64_t defaultValue = 0);
46 void PutString(llvm::StringRef key, llvm::StringRef value);
47 void PutInt(llvm::StringRef key,
int value);
48 void PutDouble(llvm::StringRef key,
double value);
49 void PutFloat(llvm::StringRef key,
float value);
50 void PutBoolean(llvm::StringRef key,
bool value);
51 void PutLong(llvm::StringRef key, int64_t value);
53 "Saving is now automatically performed by the NetworkTables server.")
56 void Remove(llvm::StringRef key);
63 std::shared_ptr<ITable> m_table;
66 void ValueChanged(
ITable* source, llvm::StringRef key,
67 std::shared_ptr<nt::Value> value,
bool isNew)
override;
68 void ValueChangedEx(
ITable* source, llvm::StringRef key,
69 std::shared_ptr<nt::Value> value,
70 uint32_t flags)
override;
int64_t GetLong(llvm::StringRef key, int64_t defaultValue=0)
Returns the long (int64_t) at the given key.
Definition: Preferences.cpp:120
bool GetBoolean(llvm::StringRef key, bool defaultValue=false)
Returns the boolean at the given key.
Definition: Preferences.cpp:108
std::vector< std::string > GetKeys()
Returns a vector of all the keys.
Definition: Preferences.cpp:49
The preferences class provides a relatively simple way to save important values to the roboRIO to acc...
Definition: Preferences.h:35
A table whose values can be read and written to.
Definition: ITable.h:22
void PutFloat(llvm::StringRef key, float value)
Puts the given float into the preferences table.
Definition: Preferences.cpp:172
static Preferences * GetInstance()
Get the one and only Preferences object.
Definition: Preferences.cpp:39
std::string GetString(llvm::StringRef key, llvm::StringRef defaultValue="")
Returns the string at the given key.
Definition: Preferences.cpp:59
void PutBoolean(llvm::StringRef key, bool value)
Puts the given boolean into the preferences table.
Definition: Preferences.cpp:185
float GetFloat(llvm::StringRef key, float defaultValue=0.0)
Returns the float at the given key.
Definition: Preferences.cpp:96
void PutString(llvm::StringRef key, llvm::StringRef value)
Puts the given string into the preferences table.
Definition: Preferences.cpp:133
double GetDouble(llvm::StringRef key, double defaultValue=0.0)
Returns the double at the given key.
Definition: Preferences.cpp:84
A listener that listens to changes in values in a ITable.
Definition: ITableListener.h:18
void PutLong(llvm::StringRef key, int64_t value)
Puts the given long (int64_t) into the preferences table.
Definition: Preferences.cpp:198
bool ContainsKey(llvm::StringRef key)
Returns whether or not there is a key with the given name.
Definition: Preferences.cpp:217
void Remove(llvm::StringRef key)
Remove a preference.
Definition: Preferences.cpp:226
Base class for most objects.
Definition: ErrorBase.h:72
int GetInt(llvm::StringRef key, int defaultValue=0)
Returns the int at the given key.
Definition: Preferences.cpp:72
void PutDouble(llvm::StringRef key, double value)
Puts the given double into the preferences table.
Definition: Preferences.cpp:159
void PutInt(llvm::StringRef key, int value)
Puts the given int into the preferences table.
Definition: Preferences.cpp:146