SendableBase: remove unnecessary synchronization (#1797)

Also fixes the move constructor to update LiveWindow to follow the move.
This commit is contained in:
Oblarg
2019-08-03 02:47:17 -04:00
committed by Peter Johnson
parent e6d348f382
commit 3b12276bc3
5 changed files with 33 additions and 37 deletions

View File

@@ -67,8 +67,9 @@ class LiveWindow {
* Remove the component from the LiveWindow.
*
* @param sendable component to remove
* @return true if the component was removed; false if it was not present
*/
void Remove(Sendable* component);
bool Remove(Sendable* component);
/**
* Enable telemetry for a single component.

View File

@@ -1,5 +1,5 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) 2017-2018 FIRST. All Rights Reserved. */
/* Copyright (c) 2017-2019 FIRST. 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. */
@@ -10,8 +10,6 @@
#include <memory>
#include <string>
#include <wpi/mutex.h>
#include "frc/smartdashboard/Sendable.h"
namespace frc {
@@ -27,8 +25,10 @@ class SendableBase : public Sendable {
~SendableBase() override;
SendableBase(SendableBase&& rhs);
SendableBase& operator=(SendableBase&& rhs);
SendableBase(const SendableBase&) = default;
SendableBase& operator=(const SendableBase&) = default;
SendableBase(SendableBase&&);
SendableBase& operator=(SendableBase&&);
using Sendable::SetName;
@@ -73,7 +73,6 @@ class SendableBase : public Sendable {
void SetName(const wpi::Twine& moduleType, int moduleNumber, int channel);
private:
mutable wpi::mutex m_mutex;
std::string m_name;
std::string m_subsystem = "Ungrouped";
};