Move entirety of llvm namespace to wpi namespace.

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.
This commit is contained in:
Peter Johnson
2018-04-29 23:33:19 -07:00
parent 93859eb84f
commit f84018af5f
377 changed files with 2747 additions and 2742 deletions

View File

@@ -14,9 +14,9 @@
#include <string>
#include <vector>
#include <llvm/ArrayRef.h>
#include <llvm/SmallVector.h>
#include <llvm/StringRef.h>
#include <wpi/ArrayRef.h>
#include <wpi/SmallVector.h>
#include <wpi/StringRef.h>
#include "cscore_c.h"
@@ -90,7 +90,7 @@ struct RawEvent {
RawEvent() = default;
explicit RawEvent(RawEvent::Kind kind_) : kind{kind_} {}
RawEvent(llvm::StringRef name_, CS_Handle handle_, RawEvent::Kind kind_)
RawEvent(wpi::StringRef name_, CS_Handle handle_, RawEvent::Kind kind_)
: kind{kind_}, name{name_} {
if (kind_ == kSinkCreated || kind_ == kSinkDestroyed ||
kind_ == kSinkEnabled || kind_ == kSinkDisabled)
@@ -98,14 +98,14 @@ struct RawEvent {
else
sourceHandle = handle_;
}
RawEvent(llvm::StringRef name_, CS_Source source_, const VideoMode& mode_)
RawEvent(wpi::StringRef name_, CS_Source source_, const VideoMode& mode_)
: kind{kSourceVideoModeChanged},
sourceHandle{source_},
name{name_},
mode{mode_} {}
RawEvent(llvm::StringRef name_, CS_Source source_, RawEvent::Kind kind_,
RawEvent(wpi::StringRef name_, CS_Source source_, RawEvent::Kind kind_,
CS_Property property_, CS_PropertyKind propertyKind_, int value_,
llvm::StringRef valueStr_)
wpi::StringRef valueStr_)
: kind{kind_},
sourceHandle{source_},
name{name_},
@@ -138,9 +138,9 @@ struct RawEvent {
//
CS_PropertyKind GetPropertyKind(CS_Property property, CS_Status* status);
std::string GetPropertyName(CS_Property property, CS_Status* status);
llvm::StringRef GetPropertyName(CS_Property property,
llvm::SmallVectorImpl<char>& buf,
CS_Status* status);
wpi::StringRef GetPropertyName(CS_Property property,
wpi::SmallVectorImpl<char>& buf,
CS_Status* status);
int GetProperty(CS_Property property, CS_Status* status);
void SetProperty(CS_Property property, int value, CS_Status* status);
int GetPropertyMin(CS_Property property, CS_Status* status);
@@ -148,10 +148,10 @@ int GetPropertyMax(CS_Property property, CS_Status* status);
int GetPropertyStep(CS_Property property, CS_Status* status);
int GetPropertyDefault(CS_Property property, CS_Status* status);
std::string GetStringProperty(CS_Property property, CS_Status* status);
llvm::StringRef GetStringProperty(CS_Property property,
llvm::SmallVectorImpl<char>& buf,
CS_Status* status);
void SetStringProperty(CS_Property property, llvm::StringRef value,
wpi::StringRef GetStringProperty(CS_Property property,
wpi::SmallVectorImpl<char>& buf,
CS_Status* status);
void SetStringProperty(CS_Property property, wpi::StringRef value,
CS_Status* status);
std::vector<std::string> GetEnumPropertyChoices(CS_Property property,
CS_Status* status);
@@ -159,15 +159,15 @@ std::vector<std::string> GetEnumPropertyChoices(CS_Property property,
//
// Source Creation Functions
//
CS_Source CreateUsbCameraDev(llvm::StringRef name, int dev, CS_Status* status);
CS_Source CreateUsbCameraPath(llvm::StringRef name, llvm::StringRef path,
CS_Source CreateUsbCameraDev(wpi::StringRef name, int dev, CS_Status* status);
CS_Source CreateUsbCameraPath(wpi::StringRef name, wpi::StringRef path,
CS_Status* status);
CS_Source CreateHttpCamera(llvm::StringRef name, llvm::StringRef url,
CS_Source CreateHttpCamera(wpi::StringRef name, wpi::StringRef url,
CS_HttpCameraKind kind, CS_Status* status);
CS_Source CreateHttpCamera(llvm::StringRef name,
llvm::ArrayRef<std::string> urls,
CS_Source CreateHttpCamera(wpi::StringRef name,
wpi::ArrayRef<std::string> urls,
CS_HttpCameraKind kind, CS_Status* status);
CS_Source CreateCvSource(llvm::StringRef name, const VideoMode& mode,
CS_Source CreateCvSource(wpi::StringRef name, const VideoMode& mode,
CS_Status* status);
//
@@ -175,19 +175,19 @@ CS_Source CreateCvSource(llvm::StringRef name, const VideoMode& mode,
//
CS_SourceKind GetSourceKind(CS_Source source, CS_Status* status);
std::string GetSourceName(CS_Source source, CS_Status* status);
llvm::StringRef GetSourceName(CS_Source source,
llvm::SmallVectorImpl<char>& buf,
CS_Status* status);
wpi::StringRef GetSourceName(CS_Source source,
wpi::SmallVectorImpl<char>& buf,
CS_Status* status);
std::string GetSourceDescription(CS_Source source, CS_Status* status);
llvm::StringRef GetSourceDescription(CS_Source source,
llvm::SmallVectorImpl<char>& buf,
CS_Status* status);
wpi::StringRef GetSourceDescription(CS_Source source,
wpi::SmallVectorImpl<char>& buf,
CS_Status* status);
uint64_t GetSourceLastFrameTime(CS_Source source, CS_Status* status);
bool IsSourceConnected(CS_Source source, CS_Status* status);
CS_Property GetSourceProperty(CS_Source source, llvm::StringRef name,
CS_Property GetSourceProperty(CS_Source source, wpi::StringRef name,
CS_Status* status);
llvm::ArrayRef<CS_Property> EnumerateSourceProperties(
CS_Source source, llvm::SmallVectorImpl<CS_Property>& vec,
wpi::ArrayRef<CS_Property> EnumerateSourceProperties(
CS_Source source, wpi::SmallVectorImpl<CS_Property>& vec,
CS_Status* status);
VideoMode GetSourceVideoMode(CS_Source source, CS_Status* status);
bool SetSourceVideoMode(CS_Source source, const VideoMode& mode,
@@ -199,8 +199,8 @@ bool SetSourceResolution(CS_Source source, int width, int height,
bool SetSourceFPS(CS_Source source, int fps, CS_Status* status);
std::vector<VideoMode> EnumerateSourceVideoModes(CS_Source source,
CS_Status* status);
llvm::ArrayRef<CS_Sink> EnumerateSourceSinks(
CS_Source source, llvm::SmallVectorImpl<CS_Sink>& vec, CS_Status* status);
wpi::ArrayRef<CS_Sink> EnumerateSourceSinks(
CS_Source source, wpi::SmallVectorImpl<CS_Sink>& vec, CS_Status* status);
CS_Source CopySource(CS_Source source, CS_Status* status);
void ReleaseSource(CS_Source source, CS_Status* status);
@@ -226,7 +226,7 @@ std::string GetUsbCameraPath(CS_Source source, CS_Status* status);
// HttpCamera Source Functions
//
CS_HttpCameraKind GetHttpCameraKind(CS_Source source, CS_Status* status);
void SetHttpCameraUrls(CS_Source source, llvm::ArrayRef<std::string> urls,
void SetHttpCameraUrls(CS_Source source, wpi::ArrayRef<std::string> urls,
CS_Status* status);
std::vector<std::string> GetHttpCameraUrls(CS_Source source, CS_Status* status);
@@ -234,26 +234,26 @@ std::vector<std::string> GetHttpCameraUrls(CS_Source source, CS_Status* status);
// OpenCV Source Functions
//
void PutSourceFrame(CS_Source source, cv::Mat& image, CS_Status* status);
void NotifySourceError(CS_Source source, llvm::StringRef msg,
void NotifySourceError(CS_Source source, wpi::StringRef msg,
CS_Status* status);
void SetSourceConnected(CS_Source source, bool connected, CS_Status* status);
void SetSourceDescription(CS_Source source, llvm::StringRef description,
void SetSourceDescription(CS_Source source, wpi::StringRef description,
CS_Status* status);
CS_Property CreateSourceProperty(CS_Source source, llvm::StringRef name,
CS_Property CreateSourceProperty(CS_Source source, wpi::StringRef name,
CS_PropertyKind kind, int minimum, int maximum,
int step, int defaultValue, int value,
CS_Status* status);
void SetSourceEnumPropertyChoices(CS_Source source, CS_Property property,
llvm::ArrayRef<std::string> choices,
wpi::ArrayRef<std::string> choices,
CS_Status* status);
//
// Sink Creation Functions
//
CS_Sink CreateMjpegServer(llvm::StringRef name, llvm::StringRef listenAddress,
CS_Sink CreateMjpegServer(wpi::StringRef name, wpi::StringRef listenAddress,
int port, CS_Status* status);
CS_Sink CreateCvSink(llvm::StringRef name, CS_Status* status);
CS_Sink CreateCvSinkCallback(llvm::StringRef name,
CS_Sink CreateCvSink(wpi::StringRef name, CS_Status* status);
CS_Sink CreateCvSinkCallback(wpi::StringRef name,
std::function<void(uint64_t time)> processFrame,
CS_Status* status);
@@ -262,14 +262,14 @@ CS_Sink CreateCvSinkCallback(llvm::StringRef name,
//
CS_SinkKind GetSinkKind(CS_Sink sink, CS_Status* status);
std::string GetSinkName(CS_Sink sink, CS_Status* status);
llvm::StringRef GetSinkName(CS_Sink sink, llvm::SmallVectorImpl<char>& buf,
CS_Status* status);
wpi::StringRef GetSinkName(CS_Sink sink, wpi::SmallVectorImpl<char>& buf,
CS_Status* status);
std::string GetSinkDescription(CS_Sink sink, CS_Status* status);
llvm::StringRef GetSinkDescription(CS_Sink sink,
llvm::SmallVectorImpl<char>& buf,
CS_Status* status);
wpi::StringRef GetSinkDescription(CS_Sink sink,
wpi::SmallVectorImpl<char>& buf,
CS_Status* status);
void SetSinkSource(CS_Sink sink, CS_Source source, CS_Status* status);
CS_Property GetSinkSourceProperty(CS_Sink sink, llvm::StringRef name,
CS_Property GetSinkSourceProperty(CS_Sink sink, wpi::StringRef name,
CS_Status* status);
CS_Source GetSinkSource(CS_Sink sink, CS_Status* status);
CS_Sink CopySink(CS_Sink sink, CS_Status* status);
@@ -284,14 +284,14 @@ int GetMjpegServerPort(CS_Sink sink, CS_Status* status);
//
// OpenCV Sink Functions
//
void SetSinkDescription(CS_Sink sink, llvm::StringRef description,
void SetSinkDescription(CS_Sink sink, wpi::StringRef description,
CS_Status* status);
uint64_t GrabSinkFrame(CS_Sink sink, cv::Mat& image, CS_Status* status);
uint64_t GrabSinkFrameTimeout(CS_Sink sink, cv::Mat& image, double timeout,
CS_Status* status);
std::string GetSinkError(CS_Sink sink, CS_Status* status);
llvm::StringRef GetSinkError(CS_Sink sink, llvm::SmallVectorImpl<char>& buf,
CS_Status* status);
wpi::StringRef GetSinkError(CS_Sink sink, wpi::SmallVectorImpl<char>& buf,
CS_Status* status);
void SetSinkEnabled(CS_Sink sink, bool enabled, CS_Status* status);
//
@@ -331,10 +331,10 @@ void SetDefaultLogger(unsigned int min_level);
//
std::vector<UsbCameraInfo> EnumerateUsbCameras(CS_Status* status);
llvm::ArrayRef<CS_Source> EnumerateSourceHandles(
llvm::SmallVectorImpl<CS_Source>& vec, CS_Status* status);
llvm::ArrayRef<CS_Sink> EnumerateSinkHandles(
llvm::SmallVectorImpl<CS_Sink>& vec, CS_Status* status);
wpi::ArrayRef<CS_Source> EnumerateSourceHandles(
wpi::SmallVectorImpl<CS_Source>& vec, CS_Status* status);
wpi::ArrayRef<CS_Sink> EnumerateSinkHandles(
wpi::SmallVectorImpl<CS_Sink>& vec, CS_Status* status);
std::string GetHostname();

View File

@@ -65,8 +65,8 @@ class VideoProperty {
// String-specific functions
std::string GetString() const;
llvm::StringRef GetString(llvm::SmallVectorImpl<char>& buf) const;
void SetString(llvm::StringRef value);
wpi::StringRef GetString(wpi::SmallVectorImpl<char>& buf) const;
void SetString(wpi::StringRef value);
// Enum-specific functions
std::vector<std::string> GetChoices() const;
@@ -133,7 +133,7 @@ class VideoSource {
/// @param name Property name
/// @return Property contents (of kind Property::kNone if no property with
/// the given name exists)
VideoProperty GetProperty(llvm::StringRef name);
VideoProperty GetProperty(wpi::StringRef name);
/// Enumerate all properties of this source.
std::vector<VideoProperty> EnumerateProperties() const;
@@ -255,12 +255,12 @@ class UsbCamera : public VideoCamera {
/// Create a source for a USB camera based on device number.
/// @param name Source name (arbitrary unique identifier)
/// @param dev Device number (e.g. 0 for /dev/video0)
UsbCamera(llvm::StringRef name, int dev);
UsbCamera(wpi::StringRef name, int dev);
/// Create a source for a USB camera based on device path.
/// @param name Source name (arbitrary unique identifier)
/// @param path Path to device (e.g. "/dev/video0" on Linux)
UsbCamera(llvm::StringRef name, llvm::StringRef path);
UsbCamera(wpi::StringRef name, wpi::StringRef path);
/// Enumerate USB cameras on the local system.
/// @return Vector of USB camera information (one for each camera)
@@ -284,28 +284,28 @@ class HttpCamera : public VideoCamera {
/// @param name Source name (arbitrary unique identifier)
/// @param url Camera URL (e.g. "http://10.x.y.11/video/stream.mjpg")
/// @param kind Camera kind (e.g. kAxis)
HttpCamera(llvm::StringRef name, llvm::StringRef url,
HttpCamera(wpi::StringRef name, wpi::StringRef url,
HttpCameraKind kind = kUnknown);
/// Create a source for a MJPEG-over-HTTP (IP) camera.
/// @param name Source name (arbitrary unique identifier)
/// @param url Camera URL (e.g. "http://10.x.y.11/video/stream.mjpg")
/// @param kind Camera kind (e.g. kAxis)
HttpCamera(llvm::StringRef name, const char* url,
HttpCamera(wpi::StringRef name, const char* url,
HttpCameraKind kind = kUnknown);
/// Create a source for a MJPEG-over-HTTP (IP) camera.
/// @param name Source name (arbitrary unique identifier)
/// @param url Camera URL (e.g. "http://10.x.y.11/video/stream.mjpg")
/// @param kind Camera kind (e.g. kAxis)
HttpCamera(llvm::StringRef name, const std::string& url,
HttpCamera(wpi::StringRef name, const std::string& url,
HttpCameraKind kind = kUnknown);
/// Create a source for a MJPEG-over-HTTP (IP) camera.
/// @param name Source name (arbitrary unique identifier)
/// @param urls Array of Camera URLs
/// @param kind Camera kind (e.g. kAxis)
HttpCamera(llvm::StringRef name, llvm::ArrayRef<std::string> urls,
HttpCamera(wpi::StringRef name, wpi::ArrayRef<std::string> urls,
HttpCameraKind kind = kUnknown);
/// Create a source for a MJPEG-over-HTTP (IP) camera.
@@ -313,7 +313,7 @@ class HttpCamera : public VideoCamera {
/// @param urls Array of Camera URLs
/// @param kind Camera kind (e.g. kAxis)
template <typename T>
HttpCamera(llvm::StringRef name, std::initializer_list<T> urls,
HttpCamera(wpi::StringRef name, std::initializer_list<T> urls,
HttpCameraKind kind = kUnknown);
/// Get the kind of HTTP camera.
@@ -322,7 +322,7 @@ class HttpCamera : public VideoCamera {
HttpCameraKind GetHttpCameraKind() const;
/// Change the URLs used to connect to the camera.
void SetUrls(llvm::ArrayRef<std::string> urls);
void SetUrls(wpi::ArrayRef<std::string> urls);
/// Change the URLs used to connect to the camera.
template <typename T>
@@ -334,8 +334,8 @@ class HttpCamera : public VideoCamera {
/// A source that represents an Axis IP camera.
class AxisCamera : public HttpCamera {
static std::string HostToUrl(llvm::StringRef host);
static std::vector<std::string> HostToUrl(llvm::ArrayRef<std::string> hosts);
static std::string HostToUrl(wpi::StringRef host);
static std::vector<std::string> HostToUrl(wpi::ArrayRef<std::string> hosts);
template <typename T>
static std::vector<std::string> HostToUrl(std::initializer_list<T> hosts);
@@ -344,32 +344,32 @@ class AxisCamera : public HttpCamera {
/// @param name Source name (arbitrary unique identifier)
/// @param host Camera host IP or DNS name (e.g. "10.x.y.11")
/// @param kind Camera kind (e.g. kAxis)
AxisCamera(llvm::StringRef name, llvm::StringRef host);
AxisCamera(wpi::StringRef name, wpi::StringRef host);
/// Create a source for an Axis IP camera.
/// @param name Source name (arbitrary unique identifier)
/// @param host Camera host IP or DNS name (e.g. "10.x.y.11")
/// @param kind Camera kind (e.g. kAxis)
AxisCamera(llvm::StringRef name, const char* host);
AxisCamera(wpi::StringRef name, const char* host);
/// Create a source for an Axis IP camera.
/// @param name Source name (arbitrary unique identifier)
/// @param host Camera host IP or DNS name (e.g. "10.x.y.11")
/// @param kind Camera kind (e.g. kAxis)
AxisCamera(llvm::StringRef name, const std::string& host);
AxisCamera(wpi::StringRef name, const std::string& host);
/// Create a source for an Axis IP camera.
/// @param name Source name (arbitrary unique identifier)
/// @param hosts Array of Camera host IPs/DNS names
/// @param kind Camera kind (e.g. kAxis)
AxisCamera(llvm::StringRef name, llvm::ArrayRef<std::string> hosts);
AxisCamera(wpi::StringRef name, wpi::ArrayRef<std::string> hosts);
/// Create a source for an Axis IP camera.
/// @param name Source name (arbitrary unique identifier)
/// @param hosts Array of Camera host IPs/DNS names
/// @param kind Camera kind (e.g. kAxis)
template <typename T>
AxisCamera(llvm::StringRef name, std::initializer_list<T> hosts);
AxisCamera(wpi::StringRef name, std::initializer_list<T> hosts);
};
/// A source for user code to provide OpenCV images as video frames.
@@ -380,7 +380,7 @@ class CvSource : public VideoSource {
/// Create an OpenCV source.
/// @param name Source name (arbitrary unique identifier)
/// @param mode Video mode being generated
CvSource(llvm::StringRef name, const VideoMode& mode);
CvSource(wpi::StringRef name, const VideoMode& mode);
/// Create an OpenCV source.
/// @param name Source name (arbitrary unique identifier)
@@ -388,7 +388,7 @@ class CvSource : public VideoSource {
/// @param width width
/// @param height height
/// @param fps fps
CvSource(llvm::StringRef name, VideoMode::PixelFormat pixelFormat, int width,
CvSource(wpi::StringRef name, VideoMode::PixelFormat pixelFormat, int width,
int height, int fps);
/// Put an OpenCV image and notify sinks.
@@ -400,7 +400,7 @@ class CvSource : public VideoSource {
/// Signal sinks that an error has occurred. This should be called instead
/// of NotifyFrame when an error occurs.
void NotifyError(llvm::StringRef msg);
void NotifyError(wpi::StringRef msg);
/// Set source connection status. Defaults to true.
/// @param connected True for connected, false for disconnected
@@ -408,7 +408,7 @@ class CvSource : public VideoSource {
/// Set source description.
/// @param description Description
void SetDescription(llvm::StringRef description);
void SetDescription(wpi::StringRef description);
/// Create a property.
/// @param name Property name
@@ -419,7 +419,7 @@ class CvSource : public VideoSource {
/// @param defaultValue Default value
/// @param value Current value
/// @return Property
VideoProperty CreateProperty(llvm::StringRef name, VideoProperty::Kind kind,
VideoProperty CreateProperty(wpi::StringRef name, VideoProperty::Kind kind,
int minimum, int maximum, int step,
int defaultValue, int value);
@@ -431,7 +431,7 @@ class CvSource : public VideoSource {
/// @param defaultValue Default value
/// @param value Current value
/// @return Property
VideoProperty CreateIntegerProperty(llvm::StringRef name, int minimum,
VideoProperty CreateIntegerProperty(wpi::StringRef name, int minimum,
int maximum, int step, int defaultValue,
int value);
@@ -440,7 +440,7 @@ class CvSource : public VideoSource {
/// @param defaultValue Default value
/// @param value Current value
/// @return Property
VideoProperty CreateBooleanProperty(llvm::StringRef name, bool defaultValue,
VideoProperty CreateBooleanProperty(wpi::StringRef name, bool defaultValue,
bool value);
/// Create a string property.
@@ -448,14 +448,14 @@ class CvSource : public VideoSource {
/// @param defaultValue Default value
/// @param value Current value
/// @return Property
VideoProperty CreateStringProperty(llvm::StringRef name,
llvm::StringRef value);
VideoProperty CreateStringProperty(wpi::StringRef name,
wpi::StringRef value);
/// Configure enum property choices.
/// @param property Property
/// @param choices Choices
void SetEnumPropertyChoices(const VideoProperty& property,
llvm::ArrayRef<std::string> choices);
wpi::ArrayRef<std::string> choices);
/// Configure enum property choices.
/// @param property Property
@@ -517,7 +517,7 @@ class VideoSink {
/// @param name Property name
/// @return Property (kind Property::kNone if no property with
/// the given name exists or no source connected)
VideoProperty GetSourceProperty(llvm::StringRef name);
VideoProperty GetSourceProperty(wpi::StringRef name);
CS_Status GetLastStatus() const { return m_status; }
@@ -547,12 +547,12 @@ class MjpegServer : public VideoSink {
/// @param name Sink name (arbitrary unique identifier)
/// @param listenAddress TCP listen address (empty string for all addresses)
/// @param port TCP port number
MjpegServer(llvm::StringRef name, llvm::StringRef listenAddress, int port);
MjpegServer(wpi::StringRef name, wpi::StringRef listenAddress, int port);
/// Create a MJPEG-over-HTTP server sink.
/// @param name Sink name (arbitrary unique identifier)
/// @param port TCP port number
MjpegServer(llvm::StringRef name, int port) : MjpegServer(name, "", port) {}
MjpegServer(wpi::StringRef name, int port) : MjpegServer(name, "", port) {}
/// Get the listen address of the server.
std::string GetListenAddress() const;
@@ -570,7 +570,7 @@ class CvSink : public VideoSink {
/// WaitForFrame() must be called on the created sink to get each new
/// image.
/// @param name Source name (arbitrary unique identifier)
explicit CvSink(llvm::StringRef name);
explicit CvSink(wpi::StringRef name);
/// Create a sink for accepting OpenCV images in a separate thread.
/// A thread will be created that calls WaitForFrame() and calls the
@@ -580,11 +580,11 @@ class CvSink : public VideoSink {
/// time=0 if an error occurred. processFrame should call GetImage()
/// or GetError() as needed, but should not call (except in very
/// unusual circumstances) WaitForImage().
CvSink(llvm::StringRef name, std::function<void(uint64_t time)> processFrame);
CvSink(wpi::StringRef name, std::function<void(uint64_t time)> processFrame);
/// Set sink description.
/// @param description Description
void SetDescription(llvm::StringRef description);
void SetDescription(wpi::StringRef description);
/// Wait for the next frame and get the image.
/// Times out (returning 0) after timeout seconds.

View File

@@ -50,13 +50,13 @@ inline std::string VideoProperty::GetString() const {
return GetStringProperty(m_handle, &m_status);
}
inline llvm::StringRef VideoProperty::GetString(
llvm::SmallVectorImpl<char>& buf) const {
inline wpi::StringRef VideoProperty::GetString(
wpi::SmallVectorImpl<char>& buf) const {
m_status = 0;
return GetStringProperty(m_handle, buf, &m_status);
}
inline void VideoProperty::SetString(llvm::StringRef value) {
inline void VideoProperty::SetString(wpi::StringRef value) {
m_status = 0;
SetStringProperty(m_handle, value, &m_status);
}
@@ -121,7 +121,7 @@ inline bool VideoSource::IsConnected() const {
return IsSourceConnected(m_handle, &m_status);
}
inline VideoProperty VideoSource::GetProperty(llvm::StringRef name) {
inline VideoProperty VideoSource::GetProperty(wpi::StringRef name) {
m_status = 0;
return VideoProperty{GetSourceProperty(m_handle, name, &m_status)};
}
@@ -215,11 +215,11 @@ inline void VideoCamera::SetExposureManual(int value) {
SetCameraExposureManual(m_handle, value, &m_status);
}
inline UsbCamera::UsbCamera(llvm::StringRef name, int dev) {
inline UsbCamera::UsbCamera(wpi::StringRef name, int dev) {
m_handle = CreateUsbCameraDev(name, dev, &m_status);
}
inline UsbCamera::UsbCamera(llvm::StringRef name, llvm::StringRef path) {
inline UsbCamera::UsbCamera(wpi::StringRef name, wpi::StringRef path) {
m_handle = CreateUsbCameraPath(name, path, &m_status);
}
@@ -233,26 +233,26 @@ inline std::string UsbCamera::GetPath() const {
return ::cs::GetUsbCameraPath(m_handle, &m_status);
}
inline HttpCamera::HttpCamera(llvm::StringRef name, llvm::StringRef url,
inline HttpCamera::HttpCamera(wpi::StringRef name, wpi::StringRef url,
HttpCameraKind kind) {
m_handle = CreateHttpCamera(
name, url, static_cast<CS_HttpCameraKind>(static_cast<int>(kind)),
&m_status);
}
inline HttpCamera::HttpCamera(llvm::StringRef name, const char* url,
inline HttpCamera::HttpCamera(wpi::StringRef name, const char* url,
HttpCameraKind kind) {
m_handle = CreateHttpCamera(
name, url, static_cast<CS_HttpCameraKind>(static_cast<int>(kind)),
&m_status);
}
inline HttpCamera::HttpCamera(llvm::StringRef name, const std::string& url,
inline HttpCamera::HttpCamera(wpi::StringRef name, const std::string& url,
HttpCameraKind kind)
: HttpCamera(name, llvm::StringRef{url}, kind) {}
: HttpCamera(name, wpi::StringRef{url}, kind) {}
inline HttpCamera::HttpCamera(llvm::StringRef name,
llvm::ArrayRef<std::string> urls,
inline HttpCamera::HttpCamera(wpi::StringRef name,
wpi::ArrayRef<std::string> urls,
HttpCameraKind kind) {
m_handle = CreateHttpCamera(
name, urls, static_cast<CS_HttpCameraKind>(static_cast<int>(kind)),
@@ -260,7 +260,7 @@ inline HttpCamera::HttpCamera(llvm::StringRef name,
}
template <typename T>
inline HttpCamera::HttpCamera(llvm::StringRef name,
inline HttpCamera::HttpCamera(wpi::StringRef name,
std::initializer_list<T> urls,
HttpCameraKind kind) {
std::vector<std::string> vec;
@@ -277,7 +277,7 @@ inline HttpCamera::HttpCameraKind HttpCamera::GetHttpCameraKind() const {
static_cast<int>(::cs::GetHttpCameraKind(m_handle, &m_status)));
}
inline void HttpCamera::SetUrls(llvm::ArrayRef<std::string> urls) {
inline void HttpCamera::SetUrls(wpi::ArrayRef<std::string> urls) {
m_status = 0;
::cs::SetHttpCameraUrls(m_handle, urls, &m_status);
}
@@ -296,7 +296,7 @@ inline std::vector<std::string> HttpCamera::GetUrls() const {
return ::cs::GetHttpCameraUrls(m_handle, &m_status);
}
inline std::string AxisCamera::HostToUrl(llvm::StringRef host) {
inline std::string AxisCamera::HostToUrl(wpi::StringRef host) {
std::string rv{"http://"};
rv += host;
rv += "/mjpg/video.mjpg";
@@ -304,11 +304,11 @@ inline std::string AxisCamera::HostToUrl(llvm::StringRef host) {
}
inline std::vector<std::string> AxisCamera::HostToUrl(
llvm::ArrayRef<std::string> hosts) {
wpi::ArrayRef<std::string> hosts) {
std::vector<std::string> rv;
rv.reserve(hosts.size());
for (const auto& host : hosts)
rv.emplace_back(HostToUrl(llvm::StringRef{host}));
rv.emplace_back(HostToUrl(wpi::StringRef{host}));
return rv;
}
@@ -318,33 +318,33 @@ inline std::vector<std::string> AxisCamera::HostToUrl(
std::vector<std::string> rv;
rv.reserve(hosts.size());
for (const auto& host : hosts)
rv.emplace_back(HostToUrl(llvm::StringRef{host}));
rv.emplace_back(HostToUrl(wpi::StringRef{host}));
return rv;
}
inline AxisCamera::AxisCamera(llvm::StringRef name, llvm::StringRef host)
inline AxisCamera::AxisCamera(wpi::StringRef name, wpi::StringRef host)
: HttpCamera(name, HostToUrl(host), kAxis) {}
inline AxisCamera::AxisCamera(llvm::StringRef name, const char* host)
inline AxisCamera::AxisCamera(wpi::StringRef name, const char* host)
: HttpCamera(name, HostToUrl(host), kAxis) {}
inline AxisCamera::AxisCamera(llvm::StringRef name, const std::string& host)
: HttpCamera(name, HostToUrl(llvm::StringRef{host}), kAxis) {}
inline AxisCamera::AxisCamera(wpi::StringRef name, const std::string& host)
: HttpCamera(name, HostToUrl(wpi::StringRef{host}), kAxis) {}
inline AxisCamera::AxisCamera(llvm::StringRef name,
llvm::ArrayRef<std::string> hosts)
inline AxisCamera::AxisCamera(wpi::StringRef name,
wpi::ArrayRef<std::string> hosts)
: HttpCamera(name, HostToUrl(hosts), kAxis) {}
template <typename T>
inline AxisCamera::AxisCamera(llvm::StringRef name,
inline AxisCamera::AxisCamera(wpi::StringRef name,
std::initializer_list<T> hosts)
: HttpCamera(name, HostToUrl(hosts), kAxis) {}
inline CvSource::CvSource(llvm::StringRef name, const VideoMode& mode) {
inline CvSource::CvSource(wpi::StringRef name, const VideoMode& mode) {
m_handle = CreateCvSource(name, mode, &m_status);
}
inline CvSource::CvSource(llvm::StringRef name, VideoMode::PixelFormat format,
inline CvSource::CvSource(wpi::StringRef name, VideoMode::PixelFormat format,
int width, int height, int fps) {
m_handle =
CreateCvSource(name, VideoMode{format, width, height, fps}, &m_status);
@@ -355,7 +355,7 @@ inline void CvSource::PutFrame(cv::Mat& image) {
PutSourceFrame(m_handle, image, &m_status);
}
inline void CvSource::NotifyError(llvm::StringRef msg) {
inline void CvSource::NotifyError(wpi::StringRef msg) {
m_status = 0;
NotifySourceError(m_handle, msg, &m_status);
}
@@ -365,12 +365,12 @@ inline void CvSource::SetConnected(bool connected) {
SetSourceConnected(m_handle, connected, &m_status);
}
inline void CvSource::SetDescription(llvm::StringRef description) {
inline void CvSource::SetDescription(wpi::StringRef description) {
m_status = 0;
SetSourceDescription(m_handle, description, &m_status);
}
inline VideoProperty CvSource::CreateProperty(llvm::StringRef name,
inline VideoProperty CvSource::CreateProperty(wpi::StringRef name,
VideoProperty::Kind kind,
int minimum, int maximum,
int step, int defaultValue,
@@ -381,7 +381,7 @@ inline VideoProperty CvSource::CreateProperty(llvm::StringRef name,
minimum, maximum, step, defaultValue, value, &m_status)};
}
inline VideoProperty CvSource::CreateIntegerProperty(llvm::StringRef name,
inline VideoProperty CvSource::CreateIntegerProperty(wpi::StringRef name,
int minimum, int maximum,
int step, int defaultValue,
int value) {
@@ -391,7 +391,7 @@ inline VideoProperty CvSource::CreateIntegerProperty(llvm::StringRef name,
minimum, maximum, step, defaultValue, value, &m_status)};
}
inline VideoProperty CvSource::CreateBooleanProperty(llvm::StringRef name,
inline VideoProperty CvSource::CreateBooleanProperty(wpi::StringRef name,
bool defaultValue,
bool value) {
m_status = 0;
@@ -400,8 +400,8 @@ inline VideoProperty CvSource::CreateBooleanProperty(llvm::StringRef name,
0, 1, 1, defaultValue ? 1 : 0, value ? 1 : 0, &m_status)};
}
inline VideoProperty CvSource::CreateStringProperty(llvm::StringRef name,
llvm::StringRef value) {
inline VideoProperty CvSource::CreateStringProperty(wpi::StringRef name,
wpi::StringRef value) {
m_status = 0;
auto prop = VideoProperty{CreateSourceProperty(
m_handle, name, static_cast<CS_PropertyKind>(static_cast<int>(VideoProperty::Kind::kString)),
@@ -412,7 +412,7 @@ inline VideoProperty CvSource::CreateStringProperty(llvm::StringRef name,
inline void CvSource::SetEnumPropertyChoices(
const VideoProperty& property, llvm::ArrayRef<std::string> choices) {
const VideoProperty& property, wpi::ArrayRef<std::string> choices) {
m_status = 0;
SetSourceEnumPropertyChoices(m_handle, property.m_handle, choices, &m_status);
}
@@ -473,13 +473,13 @@ inline VideoSource VideoSink::GetSource() const {
return VideoSource{handle == 0 ? 0 : CopySource(handle, &m_status)};
}
inline VideoProperty VideoSink::GetSourceProperty(llvm::StringRef name) {
inline VideoProperty VideoSink::GetSourceProperty(wpi::StringRef name) {
m_status = 0;
return VideoProperty{GetSinkSourceProperty(m_handle, name, &m_status)};
}
inline MjpegServer::MjpegServer(llvm::StringRef name,
llvm::StringRef listenAddress, int port) {
inline MjpegServer::MjpegServer(wpi::StringRef name,
wpi::StringRef listenAddress, int port) {
m_handle = CreateMjpegServer(name, listenAddress, port, &m_status);
}
@@ -493,16 +493,16 @@ inline int MjpegServer::GetPort() const {
return cs::GetMjpegServerPort(m_handle, &m_status);
}
inline CvSink::CvSink(llvm::StringRef name) {
inline CvSink::CvSink(wpi::StringRef name) {
m_handle = CreateCvSink(name, &m_status);
}
inline CvSink::CvSink(llvm::StringRef name,
inline CvSink::CvSink(wpi::StringRef name,
std::function<void(uint64_t time)> processFrame) {
m_handle = CreateCvSinkCallback(name, processFrame, &m_status);
}
inline void CvSink::SetDescription(llvm::StringRef description) {
inline void CvSink::SetDescription(wpi::StringRef description) {
m_status = 0;
SetSinkDescription(m_handle, description, &m_status);
}