Remove deprecated code (#8656)

This commit is contained in:
Gold856
2026-03-15 00:28:31 -04:00
committed by GitHub
parent f1adce4cf7
commit d1fba06851
52 changed files with 10 additions and 1135 deletions

View File

@@ -86,10 +86,6 @@ void IterativeRobotBase::TeleopExit() {}
void IterativeRobotBase::TestExit() {}
void IterativeRobotBase::SetNetworkTablesFlushEnabled(bool enabled) {
m_ntFlushEnabled = enabled;
}
wpi::units::second_t IterativeRobotBase::GetPeriod() const {
return m_period;
}
@@ -171,9 +167,7 @@ void IterativeRobotBase::LoopFunc() {
m_watchdog.Disable();
// Flush NetworkTables
if (m_ntFlushEnabled) {
wpi::nt::NetworkTableInstance::GetDefault().FlushLocal();
}
wpi::nt::NetworkTableInstance::GetDefault().FlushLocal();
// Warn on loop time overruns
if (m_watchdog.IsExpired()) {

View File

@@ -1,68 +0,0 @@
// Copyright (c) FIRST and other WPILib contributors.
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
#include "wpi/system/Resource.hpp"
#include <limits>
#include <memory>
#include <string>
#include <vector>
#include "wpi/system/Errors.hpp"
#include "wpi/util/deprecated.hpp"
WPI_IGNORE_DEPRECATED
using namespace wpi;
wpi::util::mutex Resource::m_createMutex;
void Resource::CreateResourceObject(std::unique_ptr<Resource>& r,
uint32_t elements) {
std::scoped_lock lock(m_createMutex);
if (!r) {
r = std::make_unique<Resource>(elements);
}
}
WPI_UNIGNORE_DEPRECATED
Resource::Resource(uint32_t elements) {
m_isAllocated = std::vector<bool>(elements, false);
}
uint32_t Resource::Allocate(const std::string& resourceDesc) {
std::scoped_lock lock(m_allocateMutex);
for (uint32_t i = 0; i < m_isAllocated.size(); i++) {
if (!m_isAllocated[i]) {
m_isAllocated[i] = true;
return i;
}
}
throw WPILIB_MakeError(err::NoAvailableResources, "{}", resourceDesc);
}
uint32_t Resource::Allocate(uint32_t index, const std::string& resourceDesc) {
std::scoped_lock lock(m_allocateMutex);
if (index >= m_isAllocated.size()) {
throw WPILIB_MakeError(err::ChannelIndexOutOfRange, "{}", resourceDesc);
}
if (m_isAllocated[index]) {
throw WPILIB_MakeError(err::ResourceAlreadyAllocated, "{}", resourceDesc);
}
m_isAllocated[index] = true;
return index;
}
void Resource::Free(uint32_t index) {
std::unique_lock lock(m_allocateMutex);
if (index == std::numeric_limits<uint32_t>::max()) {
return;
}
if (index >= m_isAllocated.size()) {
throw WPILIB_MakeError(err::NotAllocated, "index {}", index);
}
if (!m_isAllocated[index]) {
throw WPILIB_MakeError(err::NotAllocated, "index {}", index);
}
m_isAllocated[index] = false;
}

View File

@@ -187,16 +187,6 @@ class IterativeRobotBase : public RobotBase {
*/
virtual void TestExit();
/**
* Enables or disables flushing NetworkTables every loop iteration.
* By default, this is enabled.
*
* @param enabled True to enable, false to disable
* @deprecated Deprecated without replacement.
*/
[[deprecated("Deprecated without replacement.")]]
void SetNetworkTablesFlushEnabled(bool enabled);
/**
* Gets time period between calls to Periodic() functions.
*/
@@ -229,7 +219,6 @@ class IterativeRobotBase : public RobotBase {
int m_lastMode = -1;
wpi::units::second_t m_period;
Watchdog m_watchdog;
bool m_ntFlushEnabled = true;
bool m_calledDsConnected = false;
void PrintLoopOverrunMessage();

View File

@@ -1,88 +0,0 @@
// Copyright (c) FIRST and other WPILib contributors.
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
#pragma once
#include <stdint.h>
#include <memory>
#include <string>
#include <vector>
#include "wpi/util/mutex.hpp"
namespace wpi {
/**
* The Resource class is a convenient way to track allocated resources.
*
* It tracks them as indices in the range [0 .. elements - 1]. E.g. the library
* uses this to track hardware channel allocation.
*
* The Resource class does not allocate the hardware channels or other
* resources; it just tracks which indices were marked in use by Allocate and
* not yet freed by Free.
* @deprecated Use the HandleResource classes instead
*/
class [[deprecated("Use the HandleResource classes instead")]] Resource {
public:
virtual ~Resource() = default;
/**
* Factory method to create a Resource allocation-tracker *if* needed.
*
* @param r address of the caller's Resource pointer. If *r == nullptr,
* this will construct a Resource and make *r point to it. If
* *r != nullptr, i.e. the caller already has a Resource
* instance, this won't do anything.
* @param elements the number of elements for this Resource allocator to
* track, that is, it will allocate resource numbers in the
* range [0 .. elements - 1].
*/
static void CreateResourceObject(std::unique_ptr<Resource>& r,
uint32_t elements);
/**
* Allocate storage for a new instance of Resource.
*
* Allocate a bool array of values that will get initialized to indicate that
* no resources have been allocated yet. The indices of the resources are
* [0 .. elements - 1].
*/
explicit Resource(uint32_t size);
/**
* Allocate a resource.
*
* When a resource is requested, mark it allocated. In this case, a free
* resource value within the range is located and returned after it is marked
* allocated.
*/
uint32_t Allocate(const std::string& resourceDesc);
/**
* Allocate a specific resource value.
*
* The user requests a specific resource value, i.e. channel number and it is
* verified unallocated, then returned.
*/
uint32_t Allocate(uint32_t index, const std::string& resourceDesc);
/**
* Free an allocated resource.
*
* After a resource is no longer needed, for example a destructor is called
* for a channel assignment class, Free will release the resource value so it
* can be reused somewhere else in the program.
*/
void Free(uint32_t index);
private:
std::vector<bool> m_isAllocated;
wpi::util::mutex m_allocateMutex;
static wpi::util::mutex m_createMutex;
};
} // namespace wpi

View File

@@ -23,7 +23,6 @@ classes:
AutonomousExit:
TeleopExit:
TestExit:
SetNetworkTablesFlushEnabled:
GetPeriod:
PrintWatchdogEpochs:
doc: |