Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[wpilib] Deprecate Resource #6952

Merged
merged 1 commit into from
Aug 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions wpilibc/src/main/native/cpp/Resource.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,11 @@

#include "frc/Resource.h"

#include <wpi/deprecated.h>

#include "frc/Errors.h"

WPI_IGNORE_DEPRECATED
using namespace frc;

wpi::mutex Resource::m_createMutex;
Expand All @@ -17,6 +20,7 @@ void Resource::CreateResourceObject(std::unique_ptr<Resource>& r,
r = std::make_unique<Resource>(elements);
}
}
WPI_UNIGNORE_DEPRECATED

Resource::Resource(uint32_t elements) {
m_isAllocated = std::vector<bool>(elements, false);
Expand Down
3 changes: 2 additions & 1 deletion wpilibc/src/main/native/include/frc/Resource.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,9 @@ namespace frc {
* 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 Resource {
class [[deprecated("Use the HandleResource classes instead")]] Resource {
public:
virtual ~Resource() = default;

Expand Down
3 changes: 3 additions & 0 deletions wpilibj/src/main/java/edu/wpi/first/wpilibj/Resource.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@
* created. Then, when the program actually starts - in the Robot constructor, all resources are
* initialized. This ensures that the program is restartable in memory without having to
* unload/reload.
*
* @deprecated Will be removed with no replacement.
*/
@Deprecated(forRemoval = true, since = "2025")
public final class Resource {
private static Resource resourceList;
private final boolean[] m_numAllocated;
Expand Down
Loading