[wpilibc] Return reference from GetInstance (#3247)

Improves consistency across all classes.

Affects Preferences, LiveWindow, and CameraServer.

Old commands Scheduler::GetInstance() was not updated as this is already
deprecated.
This commit is contained in:
Peter Johnson
2021-03-21 11:13:49 -07:00
committed by GitHub
parent 9550777b9d
commit a79faace1b
18 changed files with 67 additions and 64 deletions

View File

@@ -35,9 +35,9 @@ class Preferences : public ErrorBase {
/**
* Get the one and only {@link Preferences} object.
*
* @return pointer to the {@link Preferences}
* @return reference to the {@link Preferences}
*/
static Preferences* GetInstance();
static Preferences& GetInstance();
/**
* Returns a vector of all the keys.
@@ -226,7 +226,7 @@ class Preferences : public ErrorBase {
protected:
Preferences();
~Preferences() override = default;
~Preferences() override;
Preferences(Preferences&&) = default;
Preferences& operator=(Preferences&&) = default;

View File

@@ -29,7 +29,7 @@ class LiveWindow {
* This is a singleton to guarantee that there is only a single instance
* regardless of how many times GetInstance is called.
*/
static LiveWindow* GetInstance();
static LiveWindow& GetInstance();
/**
* Enable telemetry for a single component.
@@ -69,6 +69,7 @@ class LiveWindow {
private:
LiveWindow();
~LiveWindow() = default;
struct Impl;
std::unique_ptr<Impl> m_impl;