mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-28 02:11:43 +00:00
Update to 2018_v4 image and new build system. (#598)
* Revert "Force OpenCV to 3.1.0 (#602)"
This reverts commit 50ed55e8e2.
* Removes Simulation
* Removes old build system
* Removes old gtest
* Adds new gmock and gtest
* Updates to new ni-libraries
* removes MyRobot (to be replaced)
* moves files to new location
* Adds new sim backend and new test executables
* updates .styleguide and .gitignore
* Changes cpp WPILibVersion to a function
MSVC throws an AV with the old version.
* Disables USBCamera on all systems except for linux
* 2018 NI Libraries
* New build system
This commit is contained in:
committed by
Peter Johnson
parent
50ed55e8e2
commit
e1195e8b9d
73
wpilibc/src/main/native/include/Preferences.h
Normal file
73
wpilibc/src/main/native/include/Preferences.h
Normal file
@@ -0,0 +1,73 @@
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Copyright (c) FIRST 2011-2017. All Rights Reserved. */
|
||||
/* Open Source Software - may be modified and shared by FRC teams. The code */
|
||||
/* must be accompanied by the FIRST BSD license file in the root directory of */
|
||||
/* the project. */
|
||||
/*----------------------------------------------------------------------------*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "ErrorBase.h"
|
||||
#include "networktables/NetworkTable.h"
|
||||
#include "tables/ITableListener.h"
|
||||
|
||||
namespace frc {
|
||||
|
||||
/**
|
||||
* The preferences class provides a relatively simple way to save important
|
||||
* values to the roboRIO to access the next time the roboRIO is booted.
|
||||
*
|
||||
* <p>This class loads and saves from a file inside the roboRIO. The user can
|
||||
* not access the file directly, but may modify values at specific fields which
|
||||
* will then be automatically periodically saved to the file by the NetworkTable
|
||||
* server.</p>
|
||||
*
|
||||
* <p>This class is thread safe.</p>
|
||||
*
|
||||
* <p>This will also interact with {@link NetworkTable} by creating a table
|
||||
* called "Preferences" with all the key-value pairs.</p>
|
||||
*/
|
||||
class Preferences : public ErrorBase {
|
||||
public:
|
||||
static Preferences* GetInstance();
|
||||
|
||||
std::vector<std::string> GetKeys();
|
||||
std::string GetString(llvm::StringRef key, llvm::StringRef defaultValue = "");
|
||||
int GetInt(llvm::StringRef key, int defaultValue = 0);
|
||||
double GetDouble(llvm::StringRef key, double defaultValue = 0.0);
|
||||
float GetFloat(llvm::StringRef key, float defaultValue = 0.0);
|
||||
bool GetBoolean(llvm::StringRef key, bool defaultValue = false);
|
||||
int64_t GetLong(llvm::StringRef key, int64_t defaultValue = 0);
|
||||
void PutString(llvm::StringRef key, llvm::StringRef value);
|
||||
void PutInt(llvm::StringRef key, int value);
|
||||
void PutDouble(llvm::StringRef key, double value);
|
||||
void PutFloat(llvm::StringRef key, float value);
|
||||
void PutBoolean(llvm::StringRef key, bool value);
|
||||
void PutLong(llvm::StringRef key, int64_t value);
|
||||
bool ContainsKey(llvm::StringRef key);
|
||||
void Remove(llvm::StringRef key);
|
||||
|
||||
protected:
|
||||
Preferences();
|
||||
virtual ~Preferences() = default;
|
||||
|
||||
private:
|
||||
std::shared_ptr<ITable> m_table;
|
||||
class Listener : public ITableListener {
|
||||
public:
|
||||
void ValueChanged(ITable* source, llvm::StringRef key,
|
||||
std::shared_ptr<nt::Value> value, bool isNew) override;
|
||||
void ValueChangedEx(ITable* source, llvm::StringRef key,
|
||||
std::shared_ptr<nt::Value> value,
|
||||
uint32_t flags) override;
|
||||
};
|
||||
Listener m_listener;
|
||||
};
|
||||
|
||||
} // namespace frc
|
||||
Reference in New Issue
Block a user