mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-19 00:41:43 +00:00
[wpiutil] Remove STLExtras.h
This is a very inefficient header, and it's good to remove to discourage its use. Only a handful of use cases remained, and of only array_lengthof.
This commit is contained in:
@@ -7,7 +7,6 @@
|
||||
#include <opencv2/core/core.hpp>
|
||||
#include <opencv2/highgui/highgui.hpp>
|
||||
#include <opencv2/imgproc/imgproc.hpp>
|
||||
#include <wpi/STLExtras.h>
|
||||
#include <wpi/timestamp.h>
|
||||
|
||||
#include "Handle.h"
|
||||
|
||||
@@ -41,6 +41,14 @@
|
||||
|
||||
using namespace cs;
|
||||
|
||||
namespace {
|
||||
// Find the length of an array.
|
||||
template <class T, size_t N>
|
||||
constexpr inline size_t array_lengthof(T (&)[N]) {
|
||||
return N;
|
||||
}
|
||||
} // namespace
|
||||
|
||||
static constexpr char const* kPropWbAuto = "white_balance_temperature_auto";
|
||||
static constexpr char const* kPropWbValue = "white_balance_temperature";
|
||||
static constexpr char const* kPropExAuto = "exposure_auto";
|
||||
@@ -124,7 +132,7 @@ int UsbCameraImpl::RawToPercentage(const UsbCameraProperty& rawProp,
|
||||
// LifeCam exposure setting quirk
|
||||
if (m_lifecam_exposure && rawProp.name == "raw_exposure_absolute" &&
|
||||
rawProp.minimum == 5 && rawProp.maximum == 20000) {
|
||||
int nelems = wpi::array_lengthof(quirkLifeCamHd3000);
|
||||
int nelems = array_lengthof(quirkLifeCamHd3000);
|
||||
for (int i = 0; i < nelems; ++i) {
|
||||
if (rawValue < quirkLifeCamHd3000[i]) {
|
||||
return 100.0 * i / nelems;
|
||||
@@ -141,7 +149,7 @@ int UsbCameraImpl::PercentageToRaw(const UsbCameraProperty& rawProp,
|
||||
// LifeCam exposure setting quirk
|
||||
if (m_lifecam_exposure && rawProp.name == "raw_exposure_absolute" &&
|
||||
rawProp.minimum == 5 && rawProp.maximum == 20000) {
|
||||
int nelems = wpi::array_lengthof(quirkLifeCamHd3000);
|
||||
int nelems = array_lengthof(quirkLifeCamHd3000);
|
||||
int ndx = nelems * percentValue / 100.0;
|
||||
if (ndx < 0) {
|
||||
ndx = 0;
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#include <wpi/STLExtras.h>
|
||||
#include <wpi/SmallVector.h>
|
||||
#include <wpi/condition_variable.h>
|
||||
#include <wpi/mutex.h>
|
||||
|
||||
@@ -22,7 +22,6 @@
|
||||
#include <vector>
|
||||
|
||||
#include <Dbt.h>
|
||||
#include <wpi/STLExtras.h>
|
||||
#include <wpi/SmallVector.h>
|
||||
#include <wpi/condition_variable.h>
|
||||
#include <wpi/mutex.h>
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
|
||||
#include "fmt/format.h"
|
||||
#include "wpi/Base64.h"
|
||||
#include "wpi/STLExtras.h"
|
||||
#include "wpi/StringExtras.h"
|
||||
#include "wpi/TCPConnector.h"
|
||||
#include "wpi/raw_ostream.h"
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
#endif
|
||||
|
||||
#include "wpi/raw_ostream.h"
|
||||
#include "wpi/STLExtras.h"
|
||||
#include "wpi/SmallString.h"
|
||||
#include "wpi/SmallVector.h"
|
||||
#include "wpi/StringExtras.h"
|
||||
@@ -65,6 +64,14 @@
|
||||
|
||||
using namespace wpi;
|
||||
|
||||
namespace {
|
||||
// Find the length of an array.
|
||||
template <class T, std::size_t N>
|
||||
constexpr inline size_t array_lengthof(T (&)[N]) {
|
||||
return N;
|
||||
}
|
||||
} // namespace
|
||||
|
||||
raw_ostream::~raw_ostream() {
|
||||
// raw_ostream's subclasses should take care to flush the buffer
|
||||
// in their destructors.
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user