mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-19 00:41:43 +00:00
During shared library loading, a different libLLVM can be pulled in, causing llvm symbols from dependent libraries to resolve to that library instead of this one. This has been seen in the wild with the Mesa OpenGL implementation in JavaFX applications (see wpilibsuite/shuffleboard#361). This is clearly a very breaking change. For some level of backwards compatibility, a namespace alias from llvm to wpi is performed in the "llvm" headers. Unfortunately, forward declarations of llvm classes will still break, but compilers seem to generate clear error messages in those cases ("namespace alias 'llvm' not allowed here, assuming 'wpi'"). This change also moves all the wpiutil headers to a single "wpi" subdirectory from the previously split "llvm", "support", "tcpsockets", and "udpsockets". Shim headers will be added for backwards compatibility in a later commit.
66 lines
2.6 KiB
C++
66 lines
2.6 KiB
C++
/*----------------------------------------------------------------------------*/
|
|
/* Copyright (c) 2017-2018 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. */
|
|
/*----------------------------------------------------------------------------*/
|
|
|
|
#pragma once
|
|
|
|
#include <atomic>
|
|
#include <memory>
|
|
|
|
#include <wpi/mutex.h>
|
|
|
|
#include "MockData/NotifyListenerVector.h"
|
|
#include "MockData/RelayData.h"
|
|
|
|
namespace hal {
|
|
class RelayData {
|
|
public:
|
|
int32_t RegisterInitializedForwardCallback(HAL_NotifyCallback callback,
|
|
void* param,
|
|
HAL_Bool initialNotify);
|
|
void CancelInitializedForwardCallback(int32_t uid);
|
|
void InvokeInitializedForwardCallback(HAL_Value value);
|
|
HAL_Bool GetInitializedForward();
|
|
void SetInitializedForward(HAL_Bool initializedForward);
|
|
|
|
int32_t RegisterInitializedReverseCallback(HAL_NotifyCallback callback,
|
|
void* param,
|
|
HAL_Bool initialNotify);
|
|
void CancelInitializedReverseCallback(int32_t uid);
|
|
void InvokeInitializedReverseCallback(HAL_Value value);
|
|
HAL_Bool GetInitializedReverse();
|
|
void SetInitializedReverse(HAL_Bool initializedReverse);
|
|
|
|
int32_t RegisterForwardCallback(HAL_NotifyCallback callback, void* param,
|
|
HAL_Bool initialNotify);
|
|
void CancelForwardCallback(int32_t uid);
|
|
void InvokeForwardCallback(HAL_Value value);
|
|
HAL_Bool GetForward();
|
|
void SetForward(HAL_Bool forward);
|
|
|
|
int32_t RegisterReverseCallback(HAL_NotifyCallback callback, void* param,
|
|
HAL_Bool initialNotify);
|
|
void CancelReverseCallback(int32_t uid);
|
|
void InvokeReverseCallback(HAL_Value value);
|
|
HAL_Bool GetReverse();
|
|
void SetReverse(HAL_Bool reverse);
|
|
|
|
virtual void ResetData();
|
|
|
|
private:
|
|
wpi::mutex m_registerMutex;
|
|
std::atomic<HAL_Bool> m_initializedForward{false};
|
|
std::shared_ptr<NotifyListenerVector> m_initializedForwardCallbacks = nullptr;
|
|
std::atomic<HAL_Bool> m_initializedReverse{false};
|
|
std::shared_ptr<NotifyListenerVector> m_initializedReverseCallbacks = nullptr;
|
|
std::atomic<HAL_Bool> m_forward{false};
|
|
std::shared_ptr<NotifyListenerVector> m_forwardCallbacks = nullptr;
|
|
std::atomic<HAL_Bool> m_reverse{false};
|
|
std::shared_ptr<NotifyListenerVector> m_reverseCallbacks = nullptr;
|
|
};
|
|
extern RelayData* SimRelayData;
|
|
} // namespace hal
|